Support » Fixing WordPress » Hiding Admin Features from Subscribers

  • Resolved Alberto

    (@ahorihuela)


    Hello Everyone!

    I’ve just upgraded my WP site to the latest 3.3 release and noticed that the subscriber admin panel now has additional features than before.

    Previously subscribers were only able to see and edit their profiles under the admin panel, but now they are able to see “Posts”, “Comments” and “Tools” under their admin panel.

    I am wondering if there might be any way to hide these features from the subscribers admin panel. I am worried it adds a layer of complexity to my subscribers who ultimately have no need for any of these additional features.

    Please help! Thank you so much in advance.

    Alberto

Viewing 2 replies - 1 through 2 (of 2 total)
  • I found this online and tweaked it.
    Works on my end. I’m using 3.3:

    function hide_menus () {
    global $menu;
    
    if(current_user_can('subscriber')):
    	$restricted = array(__('Posts'), __('Tools'), __('Comments'));
    	end ($menu);
    	while (prev($menu)){
    		$value = explode(' ',$menu[key($menu)][0]);
    		if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
    	}
    endif;
    }
    add_action('admin_menu', 'hide_menus');

    I hope that helps!

    EDIT:
    I placed the above code in my functions.php theme file.

    luisleguisamo – Perfect! That worked like a charm.

    Thanks for your help with this one!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hiding Admin Features from Subscribers’ is closed to new replies.