• Resolved ecaillon

    (@ecaillon)


    Hi all,

    Is it possible to manage the menu at the left side of the back end for kind of user? (for exemple, hide “profiles” or “comments” for suscribers).
    Does it work with special capabilities whitch are not in the modifying panel?
    Thx

    In french :
    Bonjour à tous, j’essaie de masquer certaines rubriques du menu de gauche du backoffice, selon le r?le du membre (par exemple, masquer “articles” ou “commentaires” pour les contributeurs); j’ai fais le tour du plugin mais je ne trouve pas de “capabilities” qui touche à cela. En existe-t-il d’autres, non répertoriées, ou un autre moyen simple de gérer ?a?

    Merci par avance

    • This topic was modified 4 years, 1 month ago by ecaillon.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Caseproof

    (@caseproof)

    Hi @ecaillon

    To remove Profile menu item on admin side for users with Subscriber role you can add this code at the end of your theme’s functions.php file:

    add_action( 'admin_menu', 'stop_access_profile' );
    function stop_access_profile() {
    	$user = wp_get_current_user();
    	if ( in_array( 'subscriber', (array) $user->roles ) ) {
        	remove_menu_page( 'profile.php' );
    	}
    }

    The Comments section shouldn’t be visible for Subscribers.

    Cheers

    Thread Starter ecaillon

    (@ecaillon)

    thank you !
    i also have one of my plugins displaying in this menu “quad menu”.
    how can i hide it too?

    Plugin Author Caseproof

    (@caseproof)

    Please hover over this menu item and check the part of the URL after wp-admin/ part? Then, you can modify previous code like this:

    add_action( 'admin_menu', 'stop_access_profile' );
    function stop_access_profile() {
    	$user = wp_get_current_user();
    	if ( in_array( 'subscriber', (array) $user->roles ) ) {
        	remove_menu_page( 'profile.php' );
        	remove_menu_page( 'quad-menu.php' ); // change this part according to your URL
    	}
    }

    Hopefully, that makes sense.

    Thread Starter ecaillon

    (@ecaillon)

    Thanks a lot !

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘manage backoffice menu’ is closed to new replies.