Opened 18 months ago
Last modified 3 weeks ago
#3769 new defect (bug)
WP Admin Bar - Cannot arrange "My Account" items
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.8 |
| Component: | Core | Version: | 1.5.1 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | johnjamesjacoby |
Description
If you register a new subnav item under "My Account", you can only position it above the current My Account items or below them.
This is because 'bp_setup_admin_bar' action in the core BP_Component class fires all hooks at the same priority):
http://buddypress.trac.wordpress.org/browser/tags/1.5.1/bp-core/bp-core-component.php#L221
A proposed solution involves removing the "bp_setup_admin_bar" hook from the core BP_Component class and adding it in each component's setup_actions.
Attached is a patch showing how this could be done with the friends component. It's hooked at a priority of 30 as an example.
Attachments (2)
Change History (6)
comment:1
boonebgorges — 18 months ago
- Cc johnjamesjacoby added
- Milestone changed from Awaiting Review to 1.6
- Milestone changed from 1.6 to Future Release
r-a-y: I like the idea of your patch, but don't like decoupling this from the BP_Component base class. The goal of that class is to automate all of the things a traditional component does, and this is a step away from that. I'm moving this to Future Release, but let's revisit this again in 1.7.
02.patch adds an additional parameter to BP_Component::start() so we can define an 'adminbar_position' parameter to pass onto BP_Component::setup_actions() and use it there. In the patch, I've used the Friends Component as an example.
I've opted to add a fourth parameter to BP_Component::start() instead of refactoring BP_Component::start() to use a one-parameter array like BP_Activity_Activity::get(), but we can go that route if we decide to.
Let me know what you guys think.

I agree that we should be hooking directly to setup_admin_bar. It stinks to force all BP content to be right next to each other. Would like to get feedback from jjj on that, as I know he's big on consolidating BP hooks (which I agree with in general - it's just that in this case, it has limiting factors for UX, which should take precedence).