Noptin lets you control which parts of the plugin each WordPress user role can access. For example, you can allow a customer-support role to manage subscribers, while an email-marketing role can create newsletters without giving them access to automated emails, settings, or other Noptin screens.
Noptin does not currently include a built-in screen for assigning these permissions. You can assign them using a role-management plugin or a short PHP snippet.
Choose between full and limited access
If a role should only access selected parts of Noptin, assign the specific permissions described below. WordPress refers to these permissions as capabilities.
If you simply want all WordPress editors to have full access to Noptin, follow How to allow Editors to manage Noptin instead.
Do not enable Allow Editors if you want to restrict editors to specific parts of Noptin. That setting gives editors full Noptin access and takes precedence over the capabilities below.
Available Noptin capabilities
| Allows access to | Capability |
|---|---|
| Subscribers | manage_noptin_subscribers |
| All Email Campaigns | manage_noptin_campaigns |
| Newsletters | manage_noptin_campaign_type_newsletter |
| Automated Emails | manage_noptin_campaign_type_automation |
| Sequences / Courses, including their individual emails | manage_noptin_campaign_type_sequence |
| Email Templates | manage_noptin_campaign_type_email_template |
| Automation Rules | manage_noptin_automation_rules |
The manage_noptin_campaigns capability grants access to every registered email campaign type. Use a manage_noptin_campaign_type_{type} capability instead when a role should manage only one type. Campaign types registered by an extension use the same pattern.
The manage_noptin_automation_rules capability grants access to Automation Rules. Automation Rules are separate from Automated Emails, so this capability does not grant access to Automated Emails or other campaign types.
Noptin settings, tools, and other restricted screens still require full Noptin access.
Example role setups
| Example role | Recommended access | Capabilities |
|---|---|---|
| Customer Support | Manage subscribers only | manage_noptin_subscribers |
| Email Marketer | Manage subscribers and newsletters | manage_noptin_subscribersmanage_noptin_campaign_type_newsletter |
| Campaign Manager | Manage all email campaign types | manage_noptin_campaigns |
| Automation Manager | Manage subscribers, automated emails, and automation rules | manage_noptin_subscribersmanage_noptin_campaign_type_automationmanage_noptin_automation_rules |
| Course Manager | Manage subscribers and email sequences/courses | manage_noptin_subscribersmanage_noptin_campaign_type_sequence |
| Template Designer | Manage email templates only | manage_noptin_campaign_type_email_template |
Assign access with a role-management plugin
The easiest option is to use a WordPress role-management plugin that supports custom capabilities.
- Open the role editor provided by your role-management plugin.
- Select the WordPress role you want to give Noptin access to.
- Add each Noptin capability the role needs, using the capability names shown above.
- Save your changes.
- Sign in as a user with that role and confirm that they can only access the intended parts of Noptin.
The exact steps and labels vary between role-management plugins. If a Noptin capability is not already listed, look for an option to add a custom capability and enter its name exactly as shown above.
Assign access with PHP
You can also add the capabilities directly with PHP. The following example allows users with the shop_manager role to manage subscribers and newsletters:
add_action(
'init',
function () {
$role = get_role( 'shop_manager' );
if ( ! $role ) {
return;
}
$role->add_cap( 'manage_noptin_subscribers' );
$role->add_cap( 'manage_noptin_campaign_type_newsletter' );
}
);
Add the snippet to a small custom plugin or run it with a trusted code-snippet plugin. Replace shop_manager with the role you want to modify, then add or remove capabilities depending on which parts of Noptin that role should access.
Capabilities are assigned to the role itself, so every current and future user with that role receives the same access.
WP_Role::add_cap() saves the capability in the WordPress database. Once the snippet has run successfully, you can remove it. Leaving it in place is also safe because adding an existing capability again does not create duplicates.
Remove access from a role
To revoke access, remove the capability from the role. This removes it for every user assigned to that role.
add_action(
'init',
function () {
$role = get_role( 'shop_manager' );
if ( ! $role ) {
return;
}
$role->remove_cap( 'manage_noptin_subscribers' );
$role->remove_cap( 'manage_noptin_campaign_type_newsletter' );
}
);
After the snippet has run successfully, remove it from the site and verify the change by signing in as a user with the affected role.
How these permissions interact with full Noptin access
- Administrators continue to have full access to Noptin.
- A role with the
manage_noptincapability continues to have full access. - A role with
manage_noptin_campaignscan manage all email campaign types, but it does not gain access to subscribers, Automation Rules, settings, or tools. - When Allow Editors is enabled, editors have full access regardless of any individual Noptin capabilities assigned to them.
- The other capabilities described in this guide only grant access to the named collection or campaign type. They do not grant access to Noptin settings, tools, or unrelated campaign types.
Leave a Reply