From 7935d26cd16a4f8f69a59a44e27a7263b60e54bf Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Mon, 14 Sep 2026 19:05:30 +0000
Subject: [PATCH] =Simple Calendar block up and running

---
 inc/integrations/SyncToTerm.php |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/inc/integrations/SyncToTerm.php b/inc/integrations/SyncToTerm.php
index 41facf5..02f7805 100644
--- a/inc/integrations/SyncToTerm.php
+++ b/inc/integrations/SyncToTerm.php
@@ -1,6 +1,7 @@
 <?php
 namespace JVBase\integrations;
 
+use JVBase\managers\queue\Queue;
 use JVBase\meta\Meta;
 use JVBase\registrar\Registrar;
 
@@ -25,10 +26,13 @@
 		if (empty($this->syncTaxonomies)) {
 			return;
 		}
-		remove_action('saved_term', [$this, 'handleSaveTerm'], 20, 3);
+		remove_action('saved_term', [$this, 'handleSaveTerm'], 20);
 	}
 	protected function handleSaveTerm(int $termID, int $tt_id, string $taxonomy, bool $update, array $args):void
 	{
+		if (isset(self::$syncing['terms'][$termID])) {
+			return;
+		}
 		$tax = jvbNoBase($taxonomy);
 		if (!in_array($tax, $this->syncTaxonomies)) {
 			return;
@@ -53,19 +57,25 @@
 		if ($isShared && $update && !$fields['_keep_synced_'.$this->service_name]) {
 			return;
 		}
+		self::$syncing['terms'][$termID] = true;
 		$this->removeSaveTerm();
 		$this->handleTheSaveTerm($termID, $update, $taxonomy, $settings);
 		$this->addSaveTerm();
+		unset(self::$syncing['terms'][$termID]);
 	}
 
 	/**
 	 * @param int $termID
 	 * @param bool $update
+	 * @param string $taxonomy
 	 * @param array $settings
 	 * @return void
 	 */
 	protected function handleTheSaveTerm(int $termID, bool $update, string $taxonomy, array $settings):void
 	{
+		if (!$this->isSetUp()) {
+			return;
+		}
 		error_log('==== ['.$this->title.']::handleTheSaveTerm ====');
 		//TODO: Figure out some sort of permissions for if the user can share this term, particularly for content types
 		//TODO: If this is a content type, it likely has its own integration. This is an edmonton.ink problem, so I'm offloading it for now
@@ -91,6 +101,9 @@
 	}
 	public function handleDeleteTerm(int $termID, string $taxonomy):void
 	{
+		if (!$this->isSetUp()) {
+			return;
+		}
 		if (!$this->canSync['delete']) {
 			return;
 		}

--
Gitblit v1.10.0