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

buddypress-trac noreply at wordpress.org
Fri Jun 26 23:48:39 UTC 2015


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

Comment (by imath):

 boonebgorges, thanks a lot for your feedback.

 We're BuddyPress, we can be ambitious :)

 I think, i can see right away an interest for 2 "objects" : the logged in
 user and the displayed user. Because these 2 objects are set quite early
 in the process.

 But for the blogs single item or the groups one, only one is set early the
 displayed one. There's no logged in blog or group. Both navs are set only
 if we are about to see a blog or a group + we do some checks like
 {{{bp_is_item_admin()}}} to include or not some nav items.
 So what i was thinking about r-a-y's point is.. Let's take an example. I'd
 like to display the nav of a group directly into the front page of my
 blog. I think the way it's built in the component's loader it would really
 be a massive change to let's say have a function like this
 `bp_single_item_display_nav( 45, 'groups' )` to display the nav.

 But why not :) So i've edited the patch to build a nav the way you
 suggested:
 - `$bp->component_id->nav->main[ $item_id ] = array( $nav_items )`
 - `$bp->component_id->nav->sub[ $item_id ] [ $main_nav_item ] = array(
 $sub_nav_items )`

 + i remembered some plugins like BP Groups Hierarchy (i think) can
 generate group permalinks like this >
 site.url/groups/group_parent_slug/group_slug so i've added a mechanism to
 eventually use `bp_get_group_permalink()`

 + i think we'll need an extra property in the BP_Groups_Group and
 BP_Blogs_Blog objects because the id in this last one is not the blog_id
 but the id of an association between a user and a blog. So i've used
 `item_id`.

 Then i've tested it with the unit test and an adapted version of
 6026.split.01.patch (i will add the version 6026.split.02.patch to #6026).

 It's working fine. But a feature like: `bp_single_item_display_nav( 45,
 'groups' )` is imho complicating a lot.

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


More information about the buddypress-trac mailing list