[buddypress-trac] [BuddyPress Trac] #6534: A new API to manage single items navigation

buddypress-trac noreply at wordpress.org
Fri Apr 29 18:10:54 UTC 2016


#6534: A new API to manage single items navigation
------------------------------------+------------------
 Reporter:  imath                   |       Owner:
     Type:  enhancement             |      Status:  new
 Priority:  high                    |   Milestone:  2.6
Component:  API                     |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  dev-feedback has-patch  |
------------------------------------+------------------

Comment (by imath):

 6534.03.patch is trying to take in account most of the points
 @boonebgorges and I discussed about (wednesday after the dev-chat on
 slack) and tries to come closer to what he an I are dreaming of about the
 BuddyPress Navs :)

 1. It improves some names (but as i'm not the best in this area i guess it
 can still be improved)
 2. It now uses a single object to store the navs (primary & secondary) and
 uses the parent_slug to get the children of the primary nav.
 3. Some functions has been added to the BP_Core_Nav class so that it's
 easier to add/edit/delete any item of the navs. There's also a function
 i've specially created for something i wasn't aware about >
 `bp_get_nav_menu_items` This function gets the primary nav and nests the
 secondary one as a children argument of the primary.
 4. It's also easier to request the nav items according to their
 parameters. For instance for `bp_get_nav_menu_items` i was able to
 directly remove the nav that were not `'user_has_access' === true`
 5. I've made sure everything was ok with the document's title part
 (`<title>`)
 6. The Group's has its own nav making sure to fix #5103
 7. Backward compatibility for users directly accessing to
 `buddypress()->bp_options_nav` or `buddypress()->bp_nav` is done thanks to
 the Backcompat class which implements ArrayAccess (By the way it's a real
 pain to manage multidimensional arrays with it!) If a user does, i'm
 sending a [https://cldup.com/50Db-Az9LM.png `_doing_it_wrong`]
 8. I've deprecated some nav functions and introduced new ones.

 I still need to edit the unit tests, but before doing so, i'd like to make
 sure we're on a good road! Feedbacks welcome :)

 I think it's a nice improvement and i really hope we'll have new
 BuddyPress Navs soon!

 On a side note, i'd like to understand why The Groups Extension API uses a
 specific way for adding its navigations (in the display method). I was a
 bit surprised about it, but left it the way it was to avoid breaking
 things in this part..

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6534#comment:21>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list