| | |
| | | exit; |
| | | } |
| | | |
| | | use JVBase\Instance; |
| | | use JVBase\registrar\Registrar; |
| | | use JVBase\managers\CustomTable; |
| | | use JVBase\rest\Rest; |
| | | use JVBase\rest\routes\ApprovalRoutes; |
| | | |
| | | class VerifyEntryManager { |
| | | use Instance; |
| | | protected CustomTable $table; |
| | | protected int $max = 3; |
| | | public function __construct() |
| | | protected Rest $route; |
| | | private function __construct() |
| | | { |
| | | $this->route = ApprovalRoutes::getInstance(); |
| | | $this->defineTables(); |
| | | } |
| | | |
| | | protected function defineTables():void |
| | | { |
| | | $types = implode(',', array_map(function($item) { return "`{$item}`"; },Registrar::getFeatured('verify_entry'))); |
| | | $types = implode(',', array_map(function($item) { return "`{$item}`"; },Registrar::withFeature('verify_entry'))); |
| | | |
| | | $table = CustomTable::for('verify_entry'); |
| | | |
| | |
| | | return $this->response(false, 'Term does not exist'); |
| | | } |
| | | |
| | | $profile = get_user_meta($userID, BASE.'link', true); |
| | | $profile = get_user_meta($userID, BASE.'profile_link', true); |
| | | if (empty($profile)) { |
| | | return $this->response(false, 'No Profile found'); |
| | | } |
| | |
| | | ]); |
| | | |
| | | if ($request && !empty($owners)) { |
| | | JVB()->notification()->notify($owners,'entry_requested',$userID, [ |
| | | NotificationManager::getInstance()->notify($owners,'entry_requested',$userID, [ |
| | | 'target_id' => $termID, |
| | | 'target_type' => $taxonomy |
| | | ]); |
| | |
| | | wp_set_object_terms($request['content_id'], $termID, jvbCheckBase($request['taxonomy'])); |
| | | } |
| | | |
| | | JVB()->notification()?->notify($request['user_id'],$approve ? 'entry_approved' : 'entry_denied',$userID); |
| | | NotificationManager::getInstance()?->notify($request['user_id'],$approve ? 'entry_approved' : 'entry_denied',$userID); |
| | | //TODO: What if there are multiple managers, and one approved the request? Do we just delete the notification? |
| | | JVB()->notification()?->unnotify($owners, 'entry_requested', $request['user_id'], [ |
| | | NotificationManager::getInstance()?->unnotify($owners, 'entry_requested', $request['user_id'], [ |
| | | 'target_id' => $termID, |
| | | 'target_type' => $request['taxonomy'] |
| | | ]); |