From c68aefb847b09daa0697de7684d3451e2e68ce1e Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Thu, 09 Jul 2026 23:10:23 +0000
Subject: [PATCH] =Refactor of Integrations.php to be a bit more useful with a suite of methods for create, update, delete back and forths for integrations where sharing is enabled. Also considering a single instance with a connect method to connect as the site (no user) vs connecting as an individual user - rather than recreating instances for every user.

---
 inc/managers/DashboardManager.php |   30 +++++++-----------------------
 1 files changed, 7 insertions(+), 23 deletions(-)

diff --git a/inc/managers/DashboardManager.php b/inc/managers/DashboardManager.php
index 152afc6..e8fb17c 100644
--- a/inc/managers/DashboardManager.php
+++ b/inc/managers/DashboardManager.php
@@ -218,7 +218,7 @@
 			$page = $this->getCurrentPageTitle();
 			// Check if page exists in allowed pages
 			$allowedPages = $this->getUserAllowedPages();
-
+			error_log('Allowed pages: '.print_r($allowedPages, true));
 			if (!in_array($page, $allowedPages)) {
 				error_log("User not allowed to access page: {$page}");
 				$this->redirectToDashboard();
@@ -865,6 +865,7 @@
 
     public function renderIndex(string $content, string $page):string
     {
+		jvbDump($page);
 		if ($page !== '' && $page !== 'dash') {
 			return $content;
 		}
@@ -930,28 +931,6 @@
         jvbRenderSections($this->userLink, 'post', $type);
     }
 
-    protected function renderSettings():void
-    {
-		wp_enqueue_script('jvb-form');
-        wp_enqueue_script(
-            'jvb-bio-manager',
-            JVB_URL.'assets/js/min/bioManager.min.js',
-            array('jvb-client-queue', 'sortablejs', 'quill-js', 'jvb-taxonomy-selector'),
-            '1.0.0',
-            true
-        );
-        wp_localize_script('jvb-bio-manager', 'bioSettings', [
-            'type'   => 'user_settings',
-        ]);
-		$content = apply_filters('jvbDashboardSettings', '');
-		if ($content !== '') {
-			echo $content;
-		} else {
-			jvbRenderSections($this->user->ID, 'user', jvbUserRole());
-		}
-
-    }
-
 	protected function getIntegrationsMenu():string
 	{
 		$integrations = JVB()->getAvailableServices(false);
@@ -1225,6 +1204,7 @@
 
         echo jvbNewModal(
             'edit-modal '.$type,
+			'edit-modal',
             'Edit '.ucfirst($type),
             jvbRenderForm('admin', $fields)
         );
@@ -1343,12 +1323,14 @@
 		}
 
 		if (!$user || !$this->userHasDashboardAccess($user)) {
+			error_log('No Dashboard Access');
 			return [];
 		}
 
 
 		$pages = $this->cache->get($userID);
 
+		$pages = false;
 		if ($pages === false || JVB_TESTING) {
 			if (user_can($userID, 'manage_options')) {
 				// Admin gets all pages as flat array
@@ -1361,6 +1343,7 @@
 			$pages = $this->getAllDashboardPages();
 
 			$canSkip = user_can($userID, 'skip_moderation');
+			jvbDump($pages, 'All Pages');
 			foreach($pages as $key => $slug) {
 				//Default to Remove pages
 				$remove = true;
@@ -1456,6 +1439,7 @@
 								}
 							}
 							break;
+						case 'Account':
 						case 'dash':
 						case 'Referrals':
 						case 'favourites':

--
Gitblit v1.10.0