From 88d9e0e2b7997eb0c96dc737082c91b4e3f7ca6e Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 17 Jun 2026 15:10:37 +0000
Subject: [PATCH] =Fixed for single image upload fields populating the image meta. Need to check galleries now.

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

diff --git a/inc/managers/RoleManager.php b/inc/managers/RoleManager.php
index a22b585..e859813 100644
--- a/inc/managers/RoleManager.php
+++ b/inc/managers/RoleManager.php
@@ -441,9 +441,9 @@
 		$content = jvbNoBase($content);
 		$registrar = Registrar::getInstance($content);
 		if ($registrar && $registrar->getPlural()) {
-			return str_replace(' ', '_', $registrar->getPlural());
+			return strtolower(str_replace(' ', '_', $registrar->getPlural()));
 		}
-		return str_replace(' ', '_', $content.'s');
+		return strtolower(str_replace(' ', '_', $content.'s'));
 	}
 
 	public static function activate(): void
@@ -821,6 +821,18 @@
 		}
 		return null;
 	}
+	public static function getPermissionName(string $action, string $content, ?int $ID = null):?string
+	{
+		$plural = (new self())->getContentPlural($content);
+		switch ($action) {
+			case 'edit':
+				if ($ID) {
+					return "edit_{$content}";
+				}
+				return "edit_{$plural}";
+		}
+		return null;
+	}
 
 	public function maybeSwitchPermissions(int $object_id, array $terms, array $tt_ids, string $taxonomy, bool $append, array $old_tt_ids):void
 	{

--
Gitblit v1.10.0