This topic has 9 replies, 3 voices, and was last updated 9 years by PitrusCitrus.

  • Author

    Tagged: 

  • #45807
     blazej91
    Participant

    Hi there,
    here is an issue: when typical guest goes into my website, he can see an login/register toolbar on the top.
    Check an attachment to see what do I mean.

    I don’t want anyone to see that toolbar, but also I want to have this toolbar for me, as an admin. Can you help me?
    Best regards
    Blazej

    Attachments:
    You must be logged in to view attached files.
    #45809
     sharmstr
    Moderator

    Common WordPress question. Please google it.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #45813
     blazej91
    Participant

    Thanks for advice, but it’s propably not it.
    I found this: http://www.wpbeginner.com/wp-tutorials/how-to-disable-wordpress-admin-bar-for-all-users-except-administrators/

    Do you mean to add this piece of code to functions.php?

    COPY CODE
    add_action('after_setup_theme', 'remove_admin_bar');
    
    function remove_admin_bar() {
    if (!current_user_can('administrator') && !is_admin()) {
      show_admin_bar(false);
    }
    }

    I’m sorry my friend, but it’s just doesn’t work.

    #45816
     sharmstr
    Moderator

    change ‘after_setup_theme’ to init.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #46075
     blazej91
    Participant

    I’m sorry but i dont understand. What is ‘init’, and what exactly should I do?
    Thanks for your patience
    Best regards
    Blazej

    #46076
     sharmstr
    Moderator
    COPY CODE
    
    add_action('init', 'remove_admin_bar');
     
    function remove_admin_bar() {
    if (!current_user_can('administrator') && !is_admin()) {
      show_admin_bar(false);
    }
    }
    
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #46077
     blazej91
    Participant

    Yes, perfect, it works. Thank you.
    Wish you all the best from Poland.
    Blazej

    #71218
     PitrusCitrus
    Participant

    Hi,
    I have the same issue and this is definitely not a “Common WordPress question” as the first reply claims it to be.

    I’ve used WordPress for more than 5 years with multiple themes and never encountered this issue. The admin bar is never shown by default for no other than logged in users only.

    There seems to be issues with the KLEO specific admin toolbar settings.
    At: Theme Options > Miscellaneous > Admin toolbar.
    When it’s set to ‘ON’, everyone who visits the site will see the WP toolbar. And when it is set to ‘OFF’ It does not show the toolbar even if you are logged in as it usually does. This is not a default WP setup.

    Is this a bug or why would anyone want to have the WordPress toolbar visible for all visitors? I don’t see why anyone would?

    Also for the login redirect function options. Where you can choose ‘Default WordPress redirect’. When I choose that, it redirects me to the homepage after login, not to the wp-admin as WP default setup does.

    Would be great if you could solve this issue so that we don’t need to make changes to the code. For example having a third option that is the actual WP default which displays the WP toolbar only for logged in users and not for other visitors.

    Thanks for an otherwise great theme.
    Regards Pitrus

    #71221
     sharmstr
    Moderator

    The option for the admin bar in theme options only initiates code if its set to off. So, by default, if its set to “on” it will follow the standard WP way of showing it to to logged in users and not guests. If your site is hiding it for non-admins perhaps its a plugin doing that. I know woocommerce will do that. Same for showing it to guests. If you have “Show the toolbar for logged out users” enabled in buddypress, then it will show the toolbar. Again, Kleo isnt doing this. You could’ve easily tested this by temporarily enabling the WP 2015 Theme.

    Same thing for Default wordpress redirect. If you have BP enabled it will go to homepage. If you have woo enabled it will go to my-account.

    Take Kleo completely out of the picture by enabling the 2015 theme. Only disable k-elements, nothing else. Dont make any other changes and test your site again and tell me if I’m wrong.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #71241
     PitrusCitrus
    Participant

    Hi,

    Thanks for the quick reply. The problem was as you mentioned, that the “Show the toolbar for logged out users” was enabled in BuddyPress settings. So it was not WordPress nor KLEO, the “issue” was with BuddyPress. Did not know that buddypress had the option to show the toolbar for all users.

    This solved the problem without the need for a code change =)

    Thanks,
    Pitrus

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

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?