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/registrar/Registrar.php | 46 ++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/inc/registrar/Registrar.php b/inc/registrar/Registrar.php
index 686836e..83c36bd 100644
--- a/inc/registrar/Registrar.php
+++ b/inc/registrar/Registrar.php
@@ -32,6 +32,7 @@
protected string $type;
protected string $singular;
protected string $plural;
+ protected string $profile;
protected string $description ='';
protected Fields $fields;
protected array $sections = [];
@@ -187,6 +188,16 @@
* @var array slugs of other user roles this role can manage
*/
protected array $manage_others = [];
+ /**
+ * @var string The slug of the taxonomy that defines different access points
+ * Example, for edmonton.ink, we have artist_type, and $this->>can_create would be:
+ * [
+ * 'piercer' => ['piercings', 'artwork', 'events'],
+ * 'tattoo_artist'=> ['tattoos', 'artwork', 'events'],
+ * 'artist' => ['artwork']
+ * ]
+ */
+ protected string $user_subtype;
/** Configs **/
protected Breadcrumbs $breadcrumbs;
@@ -219,7 +230,7 @@
// $this->initClasses();
$this->setFields();
- add_action('init', [$this, 'register'], 0);
+ add_action('init', [$this, 'register'], 2);
add_filter('jvbDashboardPage', [$this, 'renderDashPage'], 10, 3);
}
@@ -691,7 +702,7 @@
}
if ($this->karma) {
- $this->karmaManager = KarmaManager::for($this->slug);
+ $this->karmaManager = KarmaManager::for($this->slug, $this->type);
}
}
public static function getInstance(string $slug):Registrar|false
@@ -919,7 +930,38 @@
* FLAGGED FEATURES
*****************************************************************/
+ public function profile(?string $slug = null, ?string $singular = null, ?string $plural = null):self
+ {
+ if (!$slug) {
+ $slug = $this->slug.'_profile';
+ }
+ if (!$singular) {
+ $singular = $this->singular;
+ }
+ if (!$plural) {
+ $plural = $this->plural;
+ }
+ $this->profile_link = true;
+ $this->profile = $slug;
+ return Registrar::forPost($slug, $singular, $plural);
+ }
+ public function getProfile():self|false
+ {
+ if (!$this->profile_link) {
+ return false;
+ }
+ return self::getInstance($this->profile);
+ }
+ public function setUserSubtype(string $type):self
+ {
+ $this->user_subtype = sanitize_text_field($type);
+ return $this;
+ }
+ public function getUserSubtype():string|false
+ {
+ return $this->user_subtype?:false;
+ }
}
--
Gitblit v1.10.0