Jake Vanderwerf
2026-09-14 7935d26cd16a4f8f69a59a44e27a7263b60e54bf
inc/integrations/SyncToUser.php
@@ -1,6 +1,7 @@
<?php
namespace JVBase\integrations;
use JVBase\managers\queue\Queue;
use JVBase\meta\Meta;
use JVBase\meta\Sanitizer;
use JVBase\registrar\Registrar;
@@ -35,6 +36,12 @@
   }
   protected function handleUpdateUser(int $userID):void
   {
      if (!$this->isSetUp()) {
         return;
      }
      if (isset(self::$syncing['users'][$userID])) {
         return;
      }
      $user = $this->getOrCreateUser($userID);
      if (!$user) {
         return;
@@ -44,10 +51,12 @@
      if (!empty($fields["_{$this->service_name}_item_id"])) {
         return;
      }
      self::$syncing['users'][$userID] = true;
      $this->removeSaveUser();
      $this->handleTheSaveUser($userID);
      $this->addSaveUser();
      unset(self::$syncing['users'][$userID]);
   }
   protected function getOrCreateUser(int $userID):string|false
@@ -136,6 +145,9 @@
    */
   protected function handleTheSaveUser(int $userID):void
   {
      if (!$this->isSetUp()) {
         return;
      }
      error_log('==== ['.$this->title.']::handleTheSaveUser ====');
      //TODO: This is likely only for stuff like customers.
      //If we have multiple stores connected, we may have to queue operations to update every connection's customer account if they made an order with that store