From 48721c85ebcfa973ee81719d2467ca80e4253dc9 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Fri, 01 May 2026 17:30:03 +0000
Subject: [PATCH] =Edmonton Ink hard test begins! Real testing of the managers and reset routes will commence. So far, just ensuring our classes are all loaded correctly: Site() and its sub-classes Membership, Login, etc. Care should be taken to load conditionally on 'init', as we finish defining most settings by 'plugins_loaded' at priority 5

---
 inc/helpers/crud.php |   34 +++++++++-------------------------
 1 files changed, 9 insertions(+), 25 deletions(-)

diff --git a/inc/helpers/crud.php b/inc/helpers/crud.php
index 6245bff..c5e3611 100644
--- a/inc/helpers/crud.php
+++ b/inc/helpers/crud.php
@@ -5,6 +5,7 @@
 }
 
 use JVBase\managers\Cache;
+use JVBase\managers\RoleManager;
 use JVBase\meta\Form;
 use JVBase\registrar\Registrar;
 
@@ -94,10 +95,8 @@
             'label' => 'Scrapped',
         ]
     ];
-    $permission = ($content === 'news') ? 'update' : $content;
-	$permission = JVB_CONTENT[$content]['plural']??$content.'s';
-
-    $canPublish = current_user_can("publish_{$permission}");
+	$permission = JVB()->roles()->getContentPlural($content);
+    $canPublish = current_user_can("publish_{$permission}") && current_user_can('skip_moderation');
     $out = '<div class="filters">';
     if (!empty($statusFilters)) {
         $out .= '<div class="status">';
@@ -173,9 +172,6 @@
  */
 function jvbGetBulkActions(string $content):array
 {
-
-    $permission = ($content === 'news') ? 'update' : $content;
-	$permission = JVB_CONTENT[$content]['plural']??$content.'s';
     $bulkActions = [
         'publish' => [
             'icon'        => 'show',
@@ -198,7 +194,8 @@
             'disabled'    => true,
         ]
     ];
-    if (current_user_can("publish_{$permission}")) {
+	$permission = JVB()->roles()->getContentPlural($content);
+    if (current_user_can('skip_moderation') && current_user_can("publish_{$permission}")) {
         $bulkActions['publish']['disabled'] = false;
     }
     if (current_user_can("edit_{$permission}")) {
@@ -311,28 +308,15 @@
     string $postType = '',
     bool $prefix = false
 ):void {
-    switch ($contentType) {
-        case 'post':
-            $settings = JVB_CONTENT;
-            break;
-        case 'term':
-            $settings = JVB_TAXONOMY;
-            break;
-        case 'user':
-            $settings = JVB_USER;
-            break;
-        default:
-            return;
-    }
-    $sections = $settings[$postType]['sections']??[];
-    if (empty($sections)) {
+    $registrar = Registrar::getInstance($postType);
+    if (!$registrar || empty($registrar->getSections())) {
         return;
     }
 
     echo '<div class="container">';
     $nav = '<nav class="tabs row start" role="tablist">';
     $i = 1;
-    foreach ($sections as $slug => $section) {
+    foreach ($registrar->getSections() as $slug => $section) {
         $nav .= '<button type="button" class="tab';
 
 		$ariaActive = 'false';
@@ -354,7 +338,7 @@
           data-object-id="<?=$ID?>" data-content-type="<?=$postType?>">
         <?php
         $i = 0;
-        foreach ($sections as $slug => $section) {
+        foreach ($registrar->getSections() as $slug => $section) {
             $tabName = ($prefix) ? $ID.'-'.$slug : $slug;
 
             $class = ($i == 0) ? ' active' : '';

--
Gitblit v1.10.0