Skip to:

Opened 13 years ago

Closed 8 years ago

Last modified 8 years ago

#3381 closed enhancement (fixed)

xProfile subnav links enhancement

Reported by: slaffik's profile slaFFik Owned by: slaffik's profile slaFFik
Milestone: Priority: normal
Severity: normal Version: 1.5
Component: Extended Profile Keywords:
Cc: DJPaul


I see problems with displaying profile links, such as: Public, Edit, Change avatar. So I propose an improvement.

I've created a patch that uses the same logic as for Messages subnav ('user_has_access'=>bp_is_my_profile()). Please see attached xprofile_subnav.patch that does that.

Template should be improved by adding a function called bp_is_component_subnav_exists() (or smth similar), that will return true if there is subnav and false if not. I did it, please review. It's useful to templates creation.

I would be glad to see these or similar changes in BuddyPress 1.3. Feel free to ask any questions.

Attachments (1)

xprofile_subnav.patch (2.3 KB) - added by slaFFik 13 years ago.

Download all attachments as: .zip

Change History (18)

#1 @boonebgorges
13 years ago

Can you explain how this is useful for template creation? What is a use case?

#2 @DJPaul
13 years ago

When I last tried adding 'user_has_access' => bp_is_my_profile() to all of those $sub_nav throughout all of the component, it broke visibility of items in certain situations (iirc, for admins). So any changes to those bits need to be checked carefully.

#3 @slaFFik
13 years ago

  • Cc slava.abakumov@… added
  • Keywords needs-testing added

Boone, I'm adding lots of menus under Profile nav. Some of them are for public view, some of them are for owner adding/editing actions.

I would like to use bp_core_new_nav_item() - and that's all. Just give different access via user_has_access - and no need to use lots of hooks and change default files (or coping and modifying them into the child themes).

bp_is_component_subnav_exists (or similar) will give the idea whether the main menu (Profile, or Docs or Groups or Pages - in my BP Groups Extras - or whatever) has childs or subpages. Useful for displaying the subnav when we have smth to display.

'users_has_access' => bp_is_my_profile() will close from displaying private subpages. As for me we will have much more flexibility. I have tested own patch and didn't find problems. The only not very nice but tolerable issue is that under Profile menu when you are browsing somebody's profile there will be only 1 submenu called Public, while in your code it's hidden ( "if bp_is_my_profile()" check hide it).

Boone, did I answer your question?

#4 @boonebgorges
13 years ago

slaFFik - Thanks for the explanation. It's a little bit clearer now. It seems to me that you are requesting two totally separate things: (1) the "subnav_exists" function for easier templating, and (2) for profile subnav items to be added with user_has_access => bp_is_my_profile(). Is that correct?

I think I understand why (1) would be useful.

As for (2), I agree that it would be better to hide/show these links using user_has_access (at the level of the nav construction) rather than at the template level. Paul points out that this was problematic in the past (in reality, we would need to do something like
'user_has_access' => bp_is_my_profile() || is_super_admin())

But IMO it would be better to wait to fix this across all of BP until we have integrated WP roles. That way, we can do something like
'user_has_access' => bp_is_my_profile() || current_user_can( 'bp_edit_others_profiles' )

So - if I'm understanding this correctly, I don't have a problem adding a function like what slaFFik is suggesting in (1), but the issue in (2) should be left as-is for now.

#5 @slaFFik
13 years ago

Boone, glad to be useful.
Happy to see (1).
Not happy with (2) - will try to find another solution...

Do you have an idea when WP roles will be integrated (comparing with BP 1.3 release)?

#6 @boonebgorges
13 years ago

(In [4867]) Introduces bp_nav_item_has_subnav(), to make it easier for theme and plugin developers to check whether a nav item's subnav is populated. See #3381. Props slaFFik.

#7 @boonebgorges
13 years ago

  • Keywords dev-feedback has-patch needs-testing removed
  • Milestone changed from Awaiting Review to Future Release

I'd like for roles integration to be in the next major BP release after 1.3, but that depends on whether we get enough patches from devoted developers such as yourself :) Marking this ticket as Future Release, so that we remember to revisit the issue of the profile subnav items.

#8 @slaFFik
13 years ago

Taking into account BuddyPress development circle I should say, that BP 1.4 (next major version as I understand) will be released in summer 2012 (not later) - too far from today..
BP 1.2 was released on February 16th, 2010 (a year and a half) ago!

How can I help you, guys? :)

#9 @boonebgorges
13 years ago

You can keep posting patches!

#10 @slaFFik
13 years ago

So I can take any ticket from the list (which one - awaiting review, future release or..?) and create a solution for that? How do you divide who does what?

#11 @boonebgorges
13 years ago

We try to set priorities and, to some extent, ownership, during our group dev chats, on the dev blog, or in #buddypress-dev on Freenode. (See for more info.) But, generally, people fend for themselves. If there is a bug or an enhancement that you want to see fixed, and you can provide a patch (as well as a justification for that enhancement, if necessary), it's far more likely to be considered.

So yeah, just grab some tickets from the pile, and start working on patches. If it gets to the point where you are doing a lot of fixing with a certain part of BP (as, for instance, I have done recently with some of the bp-pages stuff and the new installer, or DJPaul with bp-default improvements), then you might become the de facto, informal "owner" of that section. But start with individual tickets.

As for the milestone: Awaiting Review are just that - tickets which are awaiting triage. You're welcome to comment on them, but don't feel like you have to patch them until the core team has agreed that they are good ideas (unless you want to convince us with a patch :) ). Future Release are tickets that have generally been blessed, but we just don't have time/effort for them at the moment - so that's a good place to look. Also, you're always welcome to look at the upcoming milestones. For instance, we have started informally adding things to the 1.4 milestone:

#12 @slaFFik
13 years ago

Couldn't be better response, Boone, thank you!

#14 @DJPaul
8 years ago

@slaFFik Do we still need this after the nav changes in the last BuddyPress release?

#15 @slaFFik
8 years ago

No, it's safe to close. BuddyPress API hugely matured since then.

#16 @slaFFik
8 years ago

  • Resolution set to fixed
  • Status changed from new to closed

#17 @slaFFik
8 years ago

  • Cc slava.abakumov@… removed
  • Milestone Future Release deleted
Note: See TracTickets for help on using tickets.