From 5b5f37de365ff84fc231e414a719d1b2ff4ceff6 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Thu, 01 Jan 2026 22:38:58 +0000
Subject: [PATCH] =further feed block testing

---
 inc/managers/RoleManager.php |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/inc/managers/RoleManager.php b/inc/managers/RoleManager.php
index 417c2ee..4913bc4 100644
--- a/inc/managers/RoleManager.php
+++ b/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];
 		}

--
Gitblit v1.10.0