#6523 closed enhancement (wontfix)
Dynamic nav menu items should be easier to extend/customize
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Core | Keywords: | 2nd-opinion |
Cc: |
Description
In #5122 [7427] we introduced BP items to Appearance > Menus. At the moment, it's not really possible for a plugin to modify or add to these items.
The obvious fix for this is to add filters to bp_nav_menu_get_loggedin_pages()
and bp_nav_menu_get_loggedout_pages()
. But I have a little trepidation about this for two reasons.
(1) The process for building nav items in the Customizer is different. So a filter here may not be easily ported when #6509 is addressed.
(2) The $page_args
returned from these BP functions are page-like objects, which we fake with stdClass
objects. It's a hack that is not ideal, but is acceptable in part because it's an internal mechanism. By adding filters, it turns into a public API that we've gotta support into the future.
Attachments (1)
Change History (5)
#2
@
10 years ago
(1) About the customizer, as i'm using bp_nav_menu_get_logged[in|out]_pages()
in the patch, i don't see any problem for now, but you're right it's a bit early because, i'm not sure the request i've posted on WordPress trac will be accepted. So we might need to edit the patch on #6509
(2) good point we should improve it first.
I thought as soon as the component was adding a member's subnav in its loader class it was available into the list of nav menu items, isn't it the case anymore ?
#3
@
10 years ago
- Milestone 2.4 deleted
- Resolution set to wontfix
- Status changed from new to closed
I thought as soon as the component was adding a member's subnav in its loader class it was available into the list of nav menu items, isn't it the case anymore ?
Yeah, you're right, it does. This makes it far less important to have a separate method for customizing it. I'm going to close this ticket.
6523.diff shows what the filters would look like.
The more I think about it, the more I'm leaning toward *not* doing this, for the reasons explained in the ticket. I can hack around it in a plugin by populating and modifying the
buddypress()->wp_nav_menu_items
early in the pageload.Maybe we should wait until there's a more proper mechanism - in BP, or more likely in WP - for registering these kinds of nav menu items.