[ 'title' => 'Account', 'icon' => 'settings', ], 'notifications' => [ 'title' => 'Notifications', 'icon' => 'email' ], 'newsletter' => [ 'title' => 'Newsletter', 'icon' => 'logo' ], 'invitations' => [ 'title' => 'Invite Artists', 'icon' => 'new-user', ] ]; protected array $frequency = [ 'never' => 'Never', 'daily' => 'Daily', 'weekly' => 'Weekly', 'monthly' => 'Monthly', ]; public function initType():void { $this->object_type = 'user'; $this->userFields(); } public function getFields():array { return $this->fields; } public function getSections():array { return $this->sections; } public function userFields():void { $this->fields = [ 'display_name' => [ 'type' => 'text', 'label' => 'Name', 'description' => 'Optional. Only used if you allow artists to see your info when you favourite them.', 'default' => '', 'section' => 'account', 'role' => ['ei_enthusiast'] ], 'user_email' => [ 'type' => 'email', 'label' => 'Email', 'description' => 'Required for any notifications you subscribe to.', 'default' => '', 'section' => 'account', 'role' => ['ei_enthusiast'] ], 'city' => [ 'type' => 'text', 'label' => 'City', 'description' => 'Optional. Just helps us know where people who use this site are located.', 'default' => '', 'section' => 'account', 'role' => ['ei_enthusiast'] ], 'notify' => [ 'type' => 'true_false', 'label' => 'Notify artists when you favourite their work', 'description' => 'If you select this, artists will see your name when you favourite their work, else they will just get an anonymous notification.', 'default' => false, 'section' => 'account', ], 'dark_mode' => [ 'type' => 'true_false', 'label' => 'Dark Mode', 'default' => false, ], 'email_digest' => [ 'type' => 'radio', 'label' => 'Email Summary Frequency', 'options' => $this->frequency, 'default' => 'never', 'section' => 'notifications' ], 'digest_override' => [ 'type' => 'true_false', 'label' => 'Apply to all notifications', 'description' => 'Override individual notification settings and apply this frequency to all your notifications', 'default' => false, 'section' => 'notifications' ], 'notifications' => [ 'type' => 'callback', 'callback' => 'renderNotifications', 'label' => 'Notifications', 'section' => 'notifications', 'default' => '', ], 'site_updates' => [ 'type' => 'true_false', 'label' => 'Site Updates', 'description' => 'Get notified when new features are added to edmonton.ink', 'default' => false, 'section' => 'account', ], 'newsletter' => [ 'type' => 'true_false', 'label' => 'Newsletter', 'description' => 'Sign up for our monthly-ish newsletter, featuring upcoming events, featured artists, new artists, and their work.', 'default' => false, 'section' => 'newsletter', ], 'owner_of' => [ 'type' => 'selector', 'subtype'=> 'taxonomy', 'label' => __('Owner of', 'jvb'), 'isReference' => true, 'taxonomy' => BASE. 'shop', 'quickEdit' => true, 'default' => '', ], 'manager_of' => [ 'type' => 'selector', 'subtype' => 'taxonomy', 'label' => __('Manager of', 'jvb'), 'isReference' => true, 'taxonomy' => BASE. 'shop', 'hidden' => true, 'default' => '', ], 'invitations' => [ 'type' => 'callback', 'callback' => 'handleInvitationsManagement', 'section' => 'invitations', 'label' => __('Invite Artists', 'jvb'), 'role' => ['ei_artist'] ], ]; } /** * Render custom notification preferences UI * @param int $user_id * * @return string */ public function renderNotifications(int $user_id):string { $favourites = $this->getUserFavourites($user_id); $preferences = $this->getUserNotificationPreferences($user_id); global $notify; ob_start(); ?>
| Name | Frequency |
|---|---|
| = esc_html($item['name']); ?> | |
| Set all = $type ?>s to: |
No favourites yet
| Name | Status | Expires | Actions | |
|---|---|---|---|---|
| =$invite['name']?> | =$invite['email']?> | =$invite['status']?> | =$invite['expires_at']?> | |
| No invites yet |