Skip to:
Content

BuddyPress.org

Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#5714 closed enhancement (fixed)

Profile group tab displays when there's only one tab

Reported by: jreeve Owned by: boonebgorges
Milestone: 2.1 Priority: normal
Severity: minor Version:
Component: Templates Keywords: needs-docs has-patch
Cc:

Description

When viewing a user profile, the profile group tab (which looks more like a button or a link in my version) displays when there's only one tab. Clicking on that link does nothing, which could be confusing for users. An easy solution is to check to make sure there is more than one profile group tab before trying to display it.

See the bug report for this at Commons in a Box: https://github.com/cuny-academic-commons/cbox-theme/issues/205 and Boone's solution at https://github.com/cuny-academic-commons/cbox-theme/commit/5997ce3, which I think could be easily applied to Buddypress.

Attachments (3)

5714.patch (2.0 KB) - added by imath 5 years ago.
5714.02.patch (1.4 KB) - added by imath 5 years ago.
5714.03.patch (2.6 KB) - added by imath 5 years ago.

Download all attachments as: .zip

Change History (13)

#1 @imath
5 years ago

  • Keywords has-patch 2nd-opinion added
  • Type changed from defect (bug) to enhancement

Hi jreeve,

Thanks for your feedback. Well, this could looks like 5714.patch. First trouble is that it would need all BuddyPress themes to edit their /members/single/profile/edit.php template to benefit from this enhancement starting by the cbox theme ;)

So this enhancement might not benefit to all at first introducing some doubts in my mind about its interest. Maybe a second opinion would be interesting.

Second trouble (a detail) is about the "meaning" of the function bp_profile_has_group_tabs() i've built in the patch.. Having 1 group of profile should return true to be consistent with the name of the function and i don't manage to find a better name (must be because i'm french!)

@imath
5 years ago

#2 follow-up: @DJPaul
5 years ago

  • Component changed from Core to Theme
  • Milestone changed from Awaiting Review to Future Release

I don't feel strongly about this, but I think your patch is OK (I took only a quick look). I think if someone would add a screenshot of the element you're suggesting we hide, that would help the rest of us understand the change better. :)

#3 @boonebgorges
5 years ago

  • Keywords needs-refresh added; has-patch 2nd-opinion removed

The semantics of my naming here https://github.com/cuny-academic-commons/cbox-theme/commit/5997ce3 seem better to me ("has_multiple_tabs", which returns a boolean).

First trouble is that it would need all BuddyPress themes to edit their /members/single/profile/edit.php template to benefit from this enhancement starting by the cbox theme ;)

True, but this is strictly an enhancement. Themes that are overriding members/single/profile/edit.php will not receive the enhancement, but it won't break anything for them either.

I say, let's get a patch that looks more like the github diff linked above, and let's go with it.

#4 in reply to: ↑ 2 @imath
5 years ago

  • Keywords has-patch added; needs-refresh removed

Replying to DJPaul:

... if someone would add a screenshot of the element you're suggesting we hide, that would help the rest of us understand the change better. :)

Here's a screenshot, in profile edit screen, if only the base group is used, don't show the group of profiles nav :
https://farm4.staticflickr.com/3922/14725809672_47c68fc266_o.png

Replying to boonebgorges:

I say, let's get a patch that looks more like the github diff linked above, and let's go with it.

Did it in 5714.02.patch.

@imath
5 years ago

#5 follow-up: @boonebgorges
5 years ago

  • Keywords needs-docs added; has-patch removed
  • Milestone changed from Future Release to 2.1

Write a docblock for that new function and ship it ;)

#6 in reply to: ↑ 5 @imath
5 years ago

  • Keywords has-patch added

Replying to boonebgorges:

Write a docblock for that new function and ship it ;)

I was about to, but made an ultimate check and actually applying 5714.02 patch is not showing the group tabs at all even if there are more than one.
The problem in cbox github commit is that inside a profile loop where the group_profile_id is set, the $profile_template->groups_count will always be 1. Sorry i haven't figured out this earlier :(

So i improved a bit the semantic in my initial patch to build 5714.03.patch. It's less elegant than 5714.02, but it does the job. What do you think ?

@imath
5 years ago

#7 @boonebgorges
5 years ago

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

In 8688:

Only show the xprofile field group tabs in edit mode if there is more than one field group.

Fixes #5714

Props imath, jreeve

#8 follow-up: @boonebgorges
5 years ago

Aha, you're right, imath. I'd forgotten that we'd already filtered by group at this point.

I'm going to change your function names a bit, but go with your solution. Thanks!

#9 in reply to: ↑ 8 @imath
5 years ago

Replying to boonebgorges:

I'm going to change your function names a bit, but go with your solution. Thanks!

You're welcome :)

#10 @DJPaul
3 years ago

  • Component changed from Appearance - Template Parts to Templates
Note: See TracTickets for help on using tickets.