WP Admin Bar

This topic contains 8 replies, has 3 voices, and was last updated by  jotomas 4 days ago.

  • Author
    Posts
  • #7727

    jotomas
    Buyer
    Post count: 802

    Hello,

    I would like to know if it normal that the WP Admin Bar shows for registered users.

    If the response if yes, I would like to know if there is some UsersWP setting to hide it for all users roles, except Admin and Editor.

    I look forward to your reply.

    Thank you very much once again for your help.

    Best regards.

    #7730

    Alex Rollin
    Moderator
    Post count: 26655

    Yes
    No

    There are several third party plugins that can control that for you. Some of them have really incredible and useful options. Try a search on wp.org for that.

    #7752

    jotomas
    Buyer
    Post count: 802

    Hi Alex,

    Thank you very much for your reply.

    I had a look at existing plugins doing this.

    I believe that it would make most sense to include this setting in UsersWP. After all, I think that most GD site owners will need it, it seems very simple to implement and allows to get rid of another superfluous plugin, something which I am learning that it is becoming a basic need for every WP site owner.

    Best regards.

    #7754

    Alex Rollin
    Moderator
    Post count: 26655

    I will take up the idea for the developers to consider. They always consider popular request.

    #7755

    jotomas
    Buyer
    Post count: 802

    Hi Alex,

    Great! Thanks a lot!

    Best regards.

    #7758

    Patrik
    Moderator
    Post count: 1899

    Hi,

    Please try to add following code in your functions.php file or via code snippet plugin and let me know if it helps:

    function uwp_disable_admin_bar() {
    	if (current_user_can('administrator') || current_user_can('editor') ) {
    		show_admin_bar(true);
    	} else {
    		show_admin_bar(false);
    	}
    }
    add_action('after_setup_theme', 'uwp_disable_admin_bar');

    Regards,
    Patrik

    #7762

    jotomas
    Buyer
    Post count: 802

    Hi Patrik,

    Great! It works!

    Just a question: can I add other roles in the second line of the code?

    if (current_user_can(‘administrator’) || current_user_can(‘editor’) || current_user_can(‘third-role’) || current_user_can(‘fourth-role’)) {

    I look forward to your news.

    Thank you very much once again for your help.

    Best regards.

    #7772

    Patrik
    Moderator
    Post count: 1899

    Hi,

    Yes, you can add as many roles as you want to allow.

    Regards,
    Patrik

    #7773

    jotomas
    Buyer
    Post count: 802

    Hi Patrik,

    Perfect!

    Thanks a lot!

    Best regards.

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.