Jake Vanderwerf
2025-12-21 3aada9949d51024a92a8b5c6cb70d12f9c3cac16
inc/managers/RoleManager.php
@@ -19,8 +19,24 @@
      $this->content = array_map(function($content) {
         return strtolower($content['plural']);
      },JVB_CONTENT);
      add_action('set_user_role', [$this, 'updateRoles'], 10, 3);
    }
   public function updateRoles(int $userID, string $role, array $oldRoles):void
   {
      if (doing_action('set_user_role') > 1) {
         return;
      }
      $temp = jvbNoBase($role);
      if (array_key_exists($temp, JVB_USER)) {
         $user = get_userdata($userID);
         if (!$user) {
            return;
         }
         $this->reset($user);
         $this->setUserAs($user, $temp);
      }
   }
    /**
     * @param WP_User $user
@@ -140,7 +156,6 @@
    /**
     * @param WP_User $user
     * @param string $type
     * @param bool $add
     *
     * @return void
     */
@@ -410,7 +425,7 @@
      if (empty($capsMap)){
         $capsMap = [
            $content,
            str_replace('-', '_',sanitize_title(strtolower(JVB_CONTENT[$content]['plural'])))
            str_replace('-', '_',sanitize_title(strtolower(JVB_CONTENT[$content]['plural']??JVB_TAXONOMY[$content]['plural'])))
         ];
         return $capsMap[1];
      }