WordPress.org

Ready to get started?Download WordPress

Forums

Members
add plugin capability to roles (4 posts)

  1. Piet
    Member
    Posted 3 years ago #

    Hi Justin,

    I use your great plugin for a lot of sites where I have the administrator role and I give the site owner the site_owner role, showing a lot less of the admin to reduce the "mess-up-factor".

    Lots of plugins use a capability of 'manage_options' to define certain functionality, but that is exactly the capability that I delete for the role of site_owner.

    Usually when I do want something to show for site_owners I have to hack the plugin file and change 'manage_options' into 'manage_links' (a capability that site_owners do have).

    But I rather define those capabilities in the Member plugin.

    Is there a way to easily do this?

    As an example to illustrate what I mean we can take Headspace. Headspace has a settings menu that site_owners don't need to see, but under Tools in the Dashboard there is a handy tool to mass-edit meta-data. Within the plugin, that capability is defined to roles that can 'manage_options'. I manually change that into 'manage_links' for it to become visible for site_owners.

    http://wordpress.org/extend/plugins/members/

  2. shoclabs
    Member
    Posted 3 years ago #

    Did you solve this? I'm trying to do the same thing with another plugin

  3. Piet
    Member
    Posted 3 years ago #

    not really, I just hacked the function.php to have certain menus of the dashboard not show to the site_owner role

    // disable dashboard menus for admin with specific user_id
    add_action('admin_head', 'my_custom_dash');
    
    function my_custom_dash() {
    	$user_id = get_current_user_id();
    	if ($user_id == 8) { // is one specific admin role
    	    echo '<style type="text/css">
    		li#menu-dashboard ul, li#menu-dashboard .wp-menu-toggle, li#menu-posts, li#menu-media, li#menu-links, li#menu-pages, li#toplevel_page_gf_edit_forms, li#menu-appearance, li#menu-plugins, li#menu-users, li#menu-tools, li#menu-settings, li#toplevel_page_page-flip-image-gallery, li#toplevel_page_w3tc_general {display:none !important;}
    		#adminmenu li.wp-menu-separator {background:none;}
    		</style>';
    	} elseif ($user_id == 2) { // siteowner role
    		echo '<style type="text/css">
    		li#menu-settings {display:none !important;}
    		</style>';
    	} elseif ($user_id == 4) { // siteowner role
    		echo '<style type="text/css">
    		li#menu-settings {display:none !important;}
    		</style>';
    	} else {
    		//rest can see everything they can in that role
    	}
    }
  4. shoclabs
    Member
    Posted 3 years ago #

    Thanks mate, I'll give it a try

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic