Skip to:

Opened 13 years ago

Closed 13 years ago

Last modified 8 years ago

#3560 closed defect (bug) (fixed)

"Hide admin bar for logged out users" not working using define('BP_USE_WP_ADMIN_BAR', true);

Reported by: tsany's profile tsany Owned by:
Milestone: 1.5 Priority: minor
Severity: minor Version: 1.5
Component: Toolbar & Notifications Keywords: has-patch


as tested in my site, that setting is not working

Attachments (3)

Screenshot-3.png (86.4 KB) - added by tsany 13 years ago.
3560.001.diff (1.7 KB) - added by cnorris23 13 years ago.
3560.002.diff (1.3 KB) - added by cnorris23 13 years ago.

Download all attachments as: .zip

Change History (15)

13 years ago

#1 @cnorris23
13 years ago

  • Keywords has-patch added

Confirmed. Patch moves the 'hide-loggedout-adminbar' buddybar section, and up to the top so that it runs every time. Also phpdoc.

13 years ago

#2 @boonebgorges
13 years ago

  • Milestone changed from Awaiting Review to 1.5
  • Priority changed from normal to minor
  • Severity changed from normal to minor

Is there a WP setting for this? (I can't seem to find it, but I thought I remembered one.) I don't want our BP settings to duplicate/overlap WP core settings, if possible.

#3 @cnorris23
13 years ago

I don't think so. I'm pretty sure it's all done through filters and show_admin_bar(). By default, WP has it set to only show when logged in, but the BP code has it set to show all the time.

#4 @cnorris23
13 years ago

Right after I wrote that, I remembered that there might be a setting under Users > Your Profile. Sure enough, it was there. Are you thinking you'd like to add an additional check for this, boonebgorges?

#5 @boonebgorges
13 years ago

(In [5119]) Respect 'hide-loggedout-adminbar' when using WP admin bar. References #3560. Props cnorris23

#6 @boonebgorges
13 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [5120]) Hooks bp_core_load_admin_bar later in the load order so that BP respects WP's individual user 'show admin bar' preferences. Fixes #3560

#7 @boonebgorges
13 years ago

(In [5121]) Reverts changes in r5120, due to load order problems introduced with BuddyBar. See #3560

#8 @boonebgorges
13 years ago

I was going to implement a quick fix for the fact that we're not respecting the "when viewing site" checkbox in a user's profile, but it's turning out to be difficult. We are running bp_core_load_admin_bar() at bp_loaded, which runs at plugins_loaded, but appears to be run before the current user's preferences are being set.

When I switched the function so that it ran at bp_init (ie init), it seemed to work - "when viewing site" preferences were being respected. But when I switched on the BuddyBar, I saw that WP was still loading its adminbar stylesheet, and injecting some confounded !important padding styles directly at wp_head. Clearly, show_admin_bar() does not like being set this late.

So, there's something going on with BP that's making it override WP's native respect for the "when viewing site" setting. I'm not sure what it is, and to be honest it's not important enough for me to spend a lot more time looking at it at the moment :) If anyone else wants to have a look, please reopen the ticket with a patch.

#9 @cnorris23
13 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Turns out the problem wasn't load order. The result of show_admin_bar() takes precedence over anything else. So, when we set show_admin_bar( true ), it essentially tells WP to ignore any other settings. It's still an easy fix. I've just duplicated the check that gets ignored. The caveat is that we have to create a new function to avoid using a private WP function.

13 years ago

#10 @boonebgorges
13 years ago

Aha, I get it. This needs better documentation in WordPress ;)

#11 @boonebgorges
13 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [5126]) Makes BP respect show_admin_bar_front and _admin when using WP Admin Bar. Fixes #3560

#12 @DJPaul
8 years ago

  • Component changed from General - Toolbar/BuddyBar to Toolbar & Notifications
Note: See TracTickets for help on using tickets.