BuddyDev

Search

[Resolved] Sitewide notice disabling admin bar for users?

  • Participant
    Level: Master
    Posts: 163
    Audiomonk on #16355

    The admin bar doesn’t show for users of the site, and been trying to track down why. I contacted the theme developer, who spotted the screenshot below.

    https://pasteboard.co/HuVJN98.png

    Now sitewide notice is a part of Buddypress, so am wondering how to fix this? I still don’t want the bar showing to non logged in users.

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #16362

    HI Audiomonk,
    That sidewide notice simply is keeping a track that the admin bar is off. It is not doing anything to hide it.

    try something like this

    
    
    add_action( 'template_redirect', function () {
    	show_admin_bar(true);
    });
    
    

    See if it restores. Something is filtering on the adminbar and hiding it. It could be the theme or any of the plugin(For example, WooCommerce does it by default).

  • Participant
    Level: Master
    Posts: 163
    Audiomonk on #16379

    Thanks Brajesh,

    I’ll try this…

  • Participant
    Level: Master
    Posts: 163
    Audiomonk on #16380

    Didn’t work unfortunately, I thought I had traced the problem down to one plugin, but not yet.

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #16386

    Try searching for the filter ‘show_admin_bar’ or the function ‘show_admin_bar’ and see if a plugin/theme is overriding it with false value.

    The above code tries to reset the admin bar visibility on template_redirect. Most probably some code is doing it at even further actions like wp_head or so.

  • Participant
    Level: Master
    Posts: 163
    Audiomonk on #16394

    Still haven’t found out what’s causing it, I did use a modified version of your code above, which has brought it back. I’ll look for what’s causing the problem at a later date, this one took up too much time.

    Thanks very much for your help Brajesh as always.

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #16397

    You are welcome. I am glad it is back. I will still suggest finding the root cause and fixing it for future 🙂

You must be logged in to reply to this topic.

This topic is: resolved