From ba1e1ccf869b818f7a7a897264dfea05563a7796 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 07 Jun 2026 20:10:20 +0000
Subject: [PATCH] =Major overhaul of Integrations. Playing around with adding fields to post types through Registrar from an integrations' class file.

---
 inc/managers/CRUDManager.php |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/inc/managers/CRUDManager.php b/inc/managers/CRUDManager.php
index 4051bc6..58aa17d 100644
--- a/inc/managers/CRUDManager.php
+++ b/inc/managers/CRUDManager.php
@@ -1,6 +1,7 @@
 <?php
 namespace JVBase\managers;
 
+use JVBase\base\Site;
 use JVBase\registrar\Registrar;
 use JVBase\ui\CRUDSkeleton;
 
@@ -63,19 +64,24 @@
 		// Fields and sections
 		$this->skeleton->setFields($this->registrar->getFields());
 
-		foreach ($this->registrar->getSections() as $config) {
-			$this->skeleton->addSection($config['id'], $config);
-		}
+		jvbDump($this->registrar->getSections());
+        $sections = $this->registrar->getSections();
+        if (count($sections) > 1) {
+            foreach ($sections as $config) {
+                jvbDump($config);
+                $this->skeleton->addSection($config['id'], $config);
+            }
+        }
 
 		// Taxonomies
 		$this->initTaxonomies();
 
 		// Statuses
-		if ($this->registrar && $this->registrar->hasFeature('is_calendar')) {
+		if ($this->registrar->hasFeature('is_calendar')) {
 			$this->skeleton->setCalendar();
 		}
 
-		if ($this->registrar && $this->registrar->getType() === 'post') {
+		if ($this->registrar->getType() === 'post') {
 			$this->skeleton->setDefaultStatus();
 		} else {
 			$this->skeleton->setStatuses([]);
@@ -99,7 +105,7 @@
 		$this->skeleton->addCapabilities(['view', 'edit', 'create', 'delete']);
 
 		$plural = strtolower($this->registrar->getPlural() ?? $this->content . 's');
-		$canPublish = jvbUserIsVerified() && user_can($this->user_id, "publish_{$plural}");
+		$canPublish = $this->userIsVerified() && user_can($this->user_id, "publish_{$plural}");
 		$this->skeleton->userCanPublish($canPublish);
 
 		// Bulk actions
@@ -122,6 +128,11 @@
 		add_filter('jvbAdditionalActions', [$this, 'createItem']);
 	}
 
+	protected function userIsVerified():bool {
+		$membership = Site::membership();
+
+		return !($membership && $membership->has('member_verified')) || current_user_can('skip_moderation');
+	}
 	/**
 	 * Setup uploader configuration
 	 */

--
Gitblit v1.10.0