LogoLogo
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
  • Adjusting Notification post type labels and capabilities
  • Labels
  • Capabilities

Was this helpful?

  1. Developer
  2. General

White label mode

PreviousBundling Notification pluginNextNotifications

Last updated 6 months ago

Was this helpful?

One of the coolest Notification features is white labeling. To put it in this mode you’ll need to call just one function:

use BracketSpace\Notification\Core\Whitelabel;

add_action( 'notification/init', function() {
	Whitelabel::enable();
} );

What it does is just remove all the and . The fun part starts with the parameters you can use. See below:

Whitelabel::enable( [
	// admin page hook under which you want the Notifications to be displayed.
	'page_hook' => 'edit.php?post_type=page',
	// if display extensions.
	'extensions' => false,
	// if display settings.
	'settings' => false,
	// control settings access, provided user IDs will have access.
	// this works only if settings are enabled.
	'settings_access' => [123, 456],
] );

If the Notifications page is moved to a submenu of another page, the settings and extensions are added as a separate submenu.

Adjusting Notification post type labels and capabilities

As easy as using two filters.

Labels

add_filter( 'notification/whitelabel/cpt/labels', function( $labels ) {

	// These are the defaults.
	return [
		'name'                => __( 'Notifications', 'notification' ),
		'singular_name'       => __( 'Notification', 'notification' ),
		'add_new'             => _x( 'Add New Notification', 'notification', 'notification' ),
		'add_new_item'        => __( 'Add New Notification', 'notification' ),
		'edit_item'           => __( 'Edit Notification', 'notification' ),
		'new_item'            => __( 'New Notification', 'notification' ),
		'view_item'           => __( 'View Notification', 'notification' ),
		'search_items'        => __( 'Search Notifications', 'notification' ),
		'not_found'           => __( 'No Notifications found', 'notification' ),
		'not_found_in_trash'  => __( 'No Notifications found in Trash', 'notification' ),
		'parent_item_colon'   => __( 'Parent Notification:', 'notification' ),
		'menu_name'           => __( 'Notifications', 'notification' ),
	];

} );

Capabilities

add_filter( 'notification/post_type/capabilities', function( $capabilities ) {

	// These are the defaults.
	return [
		'edit_post'          => 'manage_options',
		'read_post'          => 'manage_options',
		'delete_post'        => 'manage_options',
		'edit_posts'         => 'manage_options',
		'edit_others_posts'  => 'manage_options',
		'delete_posts'       => 'manage_options',
		'publish_posts'      => 'manage_options',
		'read_private_posts' => 'manage_options'
	];

} );
πŸ”§
default triggers
the upselling