Notification
WordPress.orgExtensionsSupport
Version 9
Version 9
  • Notification – Custom Notifications and Alerts for WordPress
  • Updating to v9
  • Known issues
  • πŸ€Έβ€β™€οΈ User guide
    • Update broke my site
    • How Notification plugin works
    • Who can use this plugin
    • How to create Notifications
    • Troubleshooting
    • Advanced
      • How to escape { character
      • Background processing
      • How to setup different FROM address for different Notifications
      • Custom Post Type support
      • Disable upselling
      • How to send HTML Emails
  • πŸ”§Developer
    • General
      • Plugin loading chain
      • Runtime
      • Extension possibilities
      • Creating an extension
      • Customizations
      • Bundling Notification plugin
      • White label mode
    • Notifications
      • Suppressing the Notification
      • JSON synchronization
      • Programmatic Notifications
    • Triggers
      • List of all default Triggers
      • Custom Trigger
      • Enable support for non-public Custom Post Type
      • Adding Merge Tags to existing Triggers
    • Carriers
      • Custom Carrier
      • Adding custom fields to Carrier form
      • Suppressing the Carrier
    • Recipients
      • Custom Recipient
    • Snippets
      • General
        • Automatic Trigger testing
        • Allow other roles to edit Notifications
        • Programmatic Notification with manual Trigger
        • Background Processing filter
      • Triggers
        • Post
        • User
      • Integations
        • WP All Import
        • MemberPress
  • 🧩Extensions
    • Installation
    • Planned extensions
    • 3rd Party Extensions
    • Custom Fields
      • v2.2
      • v1.4
      • v1.3
    • Conditionals
    • Email Attachments
    • Push
    • Scheduled Triggers
    • Slack
    • Twilio
    • Webhooks
Powered by GitBook
On this page
  1. Developer
  2. Snippets
  3. General

Allow other roles to edit Notifications

PreviousAutomatic Trigger testingNextProgrammatic Notification with manual Trigger

Last updated 7 months ago

You can overwrite the Notification post type capabilities. .

In the example below, you are allowing everyone with an editor role or greater to manage the notifications.

add_filter(
    'notification/post_type/capabilities',
    function($capabilities) {
        return [
            'edit_post' => 'publish_posts',
            'read_post' => 'publish_posts',
            'delete_post' => 'publish_posts',
            'edit_posts' => 'publish_posts',
            'edit_others_posts' => 'publish_posts',
            'delete_posts' => 'publish_posts',
            'publish_posts' => 'publish_posts',
            'read_private_posts' => 'publish_posts',
        ];
    }
);

Please note that the capability the user has to have is unfiltered_html. Otherwise, the notification configuration won't be saved properly.

πŸ”§
See the capabilities for specific roles