How to set admin bar for Editor level?

How to set admin bar for Editor level?

there is no way to logout or very tedious to logout after enter wp-admin as there is no admin bar.

  • Milan

    Hi @pole915 ,

    I hope you are having an awesome day.!!!

    Dear @pole915, I've tested on my sandbox site and everything seems to work fine without an issue. I've created user with role of editor and logged into your site I've seen admin bar on my dashboard too. I've attached screenshot for your confirmation. :slight_smile:

    Most probably this issue will take place when you try to use course pro plugin with our membership plugin. :slight_smile:

    If this issue is taking place when you use membership 2 pro plugin with course pro you can paste this php snippet into your current active theme's functions.php file. You can fine functions.php file under current active theme's root folder. :slight_smile:

    add_filter( 'ms_controller_adminbar_remove_admin_bar_nodes_exclude', 'display_howdy_menu_for_user', '',  2);
    	function display_howdy_menu_for_user( $exclude, $nodes ){
    		$user = wp_get_current_user();
    
    		if( $user == false ) return;
    
    		if( in_array( 'subscriber', $user->roles ) || in_array( 'editor', $user->roles ) ){
    			$exclude[] = 'my-account';
    		}
    	}

    I hope this helps you.. :slight_smile:

    Please let me know if there is anything else I can help you with.. :slight_smile:

    Warmest Regards,
    Milan Savaliya,
    Support Staff ( WPMUDEV )

  • pole915

    Hi

    paste this php snippet into your current active theme's functions.php file.

    I am wondering if my website can work in this way. I have no idea where to put the snippet.
    I am having WordPress Multisite, and my theme for the website is CoursePress Pro. Are you suggesting i put the code into cPanel, root folder?

    You can fine functions.php file under current active theme's root folder. :slight_smile:

    As above, i am not sure about the specific folder to target at cpanel.

    Please advise as i am not code savvy. thanks.

  • Milan

    Hi @pole915,

    I hope you are having a good day. :slight_smile:

    I am sorry that I wasn't became clear to you where you can find functions.php file. But anyway you don't need to find that one as you are having an Multi-site environment. You didn't mention about multi-site environment so I though may be you are working on single site.

    Anyway now you just need to follow other way to test solution I've given you. Don't worry this one is also simple. :slight_smile:

    #1) Use your ftp and navigate to wp-content/mu-plugins.
    #2) If you don't see any directory with name as mu-plugins. Create one with name mu-plugins.
    #4) Create one php file with name as adminbar_solution.php inside mu-plugins directory.
    #5) Place the code I've posted in my previous post in adminbar_solution.php. file.

    That's it. :slight_smile:

    If you want to know more about what this mu-plugins stuff is all about please kindly visit https://codex.wordpress.org/Must_Use_Plugins.

    Let me know how it goes.

    Warmest Regards,
    Milan..

  • Milan

    Hi @pole915,

    I hope you are having a good day. ( Except this issue. :slight_smile: )

    What I can see is that you did everything correctly but may be in hurry you just forgot to include <?php at the first line of admin_solution.php file.

    Make sure that you have <?php at the very first line of admin_solution.php file and then you've pasted code which I've given you.

    Final view of admin_solution.php file should look like..

    <?php
    add_filter( 'ms_controller_adminbar_remove_admin_bar_nodes_exclude', 'display_howdy_menu_for_user', '',  2);
    	function display_howdy_menu_for_user( $exclude, $nodes ){
    		$user = wp_get_current_user();
    
    		if( $user == false ) return;
    
    		if( in_array( 'subscriber', $user->roles ) || in_array( 'editor', $user->roles ) ){
    			$exclude[] = 'my-account';
    		}
    	}

    I hope this helps you..

    Please let me know if there is anything else I can help you with..

    Enjoy Wpmudev..

    Warmest Regards,
    Milan..

  • Milan

    Hi @pole915,

    I hope you are having a good day. :slight_smile:

    When membership 2 pro used it will by default removes menus of admin bar for 'editor' and 'subscribe' level users. So when it used along with coursepro, you can't see menus for users who are having 'editor' and 'subscribe' roles. :slight_smile:

    I hope this helps you..

    Please let me know if there is anything else I can help you with..

    Enjoy Wpmudev..

    Warmest Regards,
    Milan..