#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 | Owned by: | |
---|---|---|---|
Milestone: | 1.5 | Priority: | minor |
Severity: | minor | Version: | 1.5 |
Component: | Toolbar & Notifications | Keywords: | has-patch |
Cc: |
Description
as tested in my site, that setting is not working
Attachments (3)
Change History (15)
#2
@
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
@
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
@
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?
#8
@
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
@
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.
Confirmed. Patch moves the 'hide-loggedout-adminbar' buddybar section, and up to the top so that it runs every time. Also phpdoc.