• Resolved NeiltheSpacechimp

    (@neilthespacechimp)


    Hi,
    I’ve made a custom user role which has quite a few capabilities but not quite as many as an administrator. the Security menu link appears in the dashboard for this user role – how do I remove it?

    It’s not appearing in other custom user roles I have created.
    Heres an example for my custom role taken from functions.php in my theme directory:

    $result = add_role('role', 'Role', array(
    
    'edit_theme_options' => true,
    'export' => true,
    'import' => false,
    
    'install_plugins' => false,
    'install_themes' => false,
    'list_users' => false,
    'manage_options' => true, //
    'promote_users' => false,
    'remove_users' => false,
    'switch_themes' => true,
    'update_core' => false,
    'update_plugins' => false,
    'update_themes' => false,
    'edit_dashboard' => true,
    
    'moderate_comments' => true , //
    'manage_categories' => true,
    'manage_links' => true,
    'edit_others_posts' => true, //
    'edit_pages' => true,
    'edit_others_pages' => true,
    'edit_published_pages' => true,
    'publish_pages' => false,
    'delete_pages' => false,
    'delete_others_pages' => false,
    'delete_published_pages' => false,
    'delete_others_posts' => true, //
    'delete_private_posts' => true, //
    'edit_private_posts' => true,//
    'read_private_posts' => true,
    'delete_private_pages' => false,
    'edit_private_pages' => true,
    'read_private_pages' => true,
    
    'edit_published_posts' => true, //
    'upload_files' => true,
    'create_product' => false,
    'publish_posts' => true,//
    'delete_published_posts' => true,//
    'edit_posts' => true,
    'delete_posts' => true,//
    'read' => true,
    
    ));

    I’m not a PHP developer so my understanding is a little limited but I did try a few things myself including this:

    //hide better wp security for all but admin
    add_action( 'admin_init', 'hide_better_security' );
    function hide_better_security() {
      if(!current_user_can('update_core')) {
        remove_menu_page('admin.php');
      }
    };

    Any pointers would be appreciated, thanks in advance

    http://wordpress.org/extend/plugins/better-wp-security/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter NeiltheSpacechimp

    (@neilthespacechimp)

    Ah it seems that the plugin is connected to ‘manage_options’ which allows user roles to see see and edit Settings in the dashboard. I’ve changed this to false which hides both the settings and Security from my new user role. – Job done.

    Thread Starter NeiltheSpacechimp

    (@neilthespacechimp)

    *solved*

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘hide better wp security from custom user role’ is closed to new replies.