Skip to:
Content

BuddyPress.org

Opened 11 years ago

Closed 11 years ago

#5343 closed defect (bug) (fixed)

wrong implementation of bp_group_current_avatar causes display error

Reported by: plocha's profile plocha Owned by: imath's profile imath
Milestone: 2.0 Priority: normal
Severity: normal Version:
Component: Groups Keywords: has-patch reporter-feedback commit
Cc:

Description

The function setup_title() in 'bp-groups-loader.php' uses the return value of bp_group_current_avatar() to get the avatar html code. But instead of returning the html code bp_group_current_avatar() outputs it directly. In my BuddyPress installation this causes a 'No Group Avatar' message.

Attachments (2)

bp_group_current_avatar.patch (772 bytes) - added by plocha 11 years ago.
5343.diff (1.8 KB) - added by imath 11 years ago.

Download all attachments as: .zip

Change History (11)

#1 follow-up: @plocha
11 years ago

Sorry, my patch file seems to be laconic. It patches bp-groups-template.php

#2 in reply to: ↑ 1 @imath
11 years ago

  • Keywords reporter-feedback added

Hi @plocha

thanks for your feedback.

I've made some research, as the image "none.gif" is not in BuddyPress trunk version.

Untill 1.0.3 /bp-groups had a subfolder named image with the image "none.gif" in it.
In 1.1 "none.gif" was moved to /bp-groups/deprecated untill 1.2.

The $bp->bp_options_nav is used by bp_get_options_avatar() which seems to be deprecated

This function was used in bp-themes folder into the optionsbar.php template of these themes

  • by bpmember & bpskeletonmember (1.0)
  • bp-sn-parent in 1.1

It used has disappeared since bp-default in 1.2.

1) In my opinion, the function bp_group_current_avatar() should echo the current group avatar by using a new function bp_get_group_current_avatar() which would return the current group avatar.

In bp-groups-loader.php, line 594, i'm not sur we should use this function as normally, the same kind of thing is already done at line 585.

If line 594 is run, this means bp_core_fetch_avatar() is returning nothing. Potential reasons can be that :

  • Showing avatar has been disabled in WordPress discussion settings.
  • current_group id is not set (< this would be strange).

2) So i think in this case we should simply fill $bp->bp_options_nav with the default avatar.

Attached 5343.diff is doing what's describe at point 1) & 2)

@plocha

  • (just to be sure) could you indicate in which version of BuddyPress your problem happens ? is it 1.9.1 ?
  • In WordPress discussion settings is the Show Avatars options activated ?

@imath
11 years ago

#3 @imath
11 years ago

  • Severity changed from minor to normal

The bug seems a lot more problematic.
if in WordPress Administration discussion settings the show avatars option is disabled then, when clicking on the group admin tab the redirection to group-edit is broken by the "none.gif" image

#4 follow-up: @boonebgorges
11 years ago

  • Milestone changed from Awaiting Review to 2.0

5343.diff looks like the right strategy to me.

imath - Have you confirmed that the redirect issue is fixed by 5343.diff?

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

Replying to boonebgorges:

imath - Have you confirmed that the redirect issue is fixed by 5343.diff?

Yes i confirm.
Actually the redirect issue is fixed by the change in bp-groups/bp-groups-loader.php (first part of the patch)

For second part, i thought that there may be themes or plugins that are using the function bp_group_current_avatar()

#6 follow-up: @boonebgorges
11 years ago

For second part, i thought that there may be themes or plugins that are using the function bp_group_current_avatar()

Possibly, but it looks like your patch wouldn't break them. By removing reference to the non-existent none.gif, it would *fix* them, right?

#7 in reply to: ↑ 6 @imath
11 years ago

Replying to boonebgorges:

Possibly, but it looks like your patch wouldn't break them. By removing reference to the non-existent none.gif, it would *fix* them, right?

Yes. The real problem as mentioned @plocha was that $bp->bp_options_nav is using bp_group_current_avatar(). In the patch, i don't use it to instead use the default avatar. As if we end up here, then the group avatar was not found.

Then if bp_group_current_avatar() is used, it will output the avatar or nothing but no more the none.gif ;)

#8 @boonebgorges
11 years ago

  • Keywords commit added

Then it sounds like we have no problems here :)

#9 @imath
11 years ago

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

In 7745:

On single group screens, uses default avatar as a fallback in group navigation menu

In case the WordPress Discussion Avatar display setting is disabled, using bp_group_current_avatar() to set group navigation menu was outputing an unfound image making the group edit screens unavailable. This fix uses default avatar as a fallback if no group avatar has been found to build the group navigation menu. It also keeps bp_group_current_avatar() function in case it is still used by a plugin or a theme, but this function now outputs the current avatar.

Fixes #5343

Note: See TracTickets for help on using tickets.