Opened 18 months ago

Last modified 3 weeks ago

#3769 new defect (bug)

WP Admin Bar - Cannot arrange "My Account" items

Reported by: r-a-y 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)

3769.01.patch (1.2 KB) - added by r-a-y 18 months ago.
3769.02.patch (2.3 KB) - added by r-a-y 8 months ago.

Download all attachments as: .zip

Change History (6)

r-a-y18 months ago

  • Cc johnjamesjacoby added
  • Milestone changed from Awaiting Review to 1.6

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).

  • 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.

r-a-y8 months ago

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.

  • Milestone changed from Future Release to 1.8

Moving this to 1.8 as it has a patch, and probably just needs a refresh and some TLC. Punt to future release if this misses the 1.8 boat.

Note: See TracTickets for help on using tickets.