1. Home
  2. Docs
  3. Subscribe2
  4. Hooks, API & Customization
  5. s2_capability


This hook allows access to the Subscribe2 menu pages to be restricted or relaxed as users see fit. Each page has an individual slug for identification. Based on the slug the default user capability can be changed to allow lower-level users to access the page or to block access for all but the highest level users. The WordPress Codex contains a list of capabilities associated with the default roles.

function s2_admin_changes( $capability, $menu ) {
    // $capability is the core WordPress capability to allow admin page access
    // $menu is the title of the page:
    //  'user' for access to personal subscription settings
    //  'manage' to allow access to the user management screen
    //  'settings' to allow access to the plugin settings
    //  'send' for access to the Send Email page
    // identify the menu you are changing capability for first
    // then return a new capability
    if ( $menu == 'send' ) {
        return 'read';
    return $capability;
add_filter('s2_capability', 's2_admin_changes', 10, 2);
Was this article helpful to you? Yes No

How can we help?