[buddypress-trac] [BuddyPress Trac] #5454: BuddyPress Groups should gracefully handle the case where show_avatars is false

buddypress-trac noreply at wordpress.org
Tue Mar 11 13:32:59 UTC 2014


#5454: BuddyPress Groups should gracefully handle the case where show_avatars is
false
--------------------------+-----------------------------
 Reporter:  jjeaton       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Avatars       |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 I recently ran into an issue where a site had `show_avatars` disabled, and
 BuddyPress group avatars were broken on the single group and group archive
 pages.

 Instead of completely removing the image markup, an `img` tag is output
 with a missing `src` attribute, and another image tag (the default 'no
 avatar' image) is output as the first child of the body element, along
 with breaking the `<head>` section.

 Missing `img` tag with missing `src`:

 {{{
 <img src="" class="avatar" alt="Test Group">
 }}}

 Broken head and image at top of body:

 {{{
 <html lang="en-US">
 <head></head>
 <body class="single-item groups logged-in group-home home buddypress
 admin-bar masthead-fixed full-width singular js customize-support">
   <img src="/none.gif" alt="No Group Avatar" class="avatar">
   <!-- the rest of the <head> tags end up here -->
 }}}

 Members do not have the same issue. When `show_avatars` is disabled, the
 image is not included in the markup.

 I believe the issue is in `bp_get_group_avatar` in `bp-groups-
 template.php`: https://buddypress.trac.wordpress.org/browser/trunk/bp-
 groups/bp-groups-template.php#L509. If `show_avatars` is false,
 `bp_core_fetch_avatar` returns nothing, and `bp_get_group_avatar` falls to
 backwards compatibility and tries to access properties on the group object
 that no longer exist.

 I tested this on a fresh installation of WP 3.8.1, the twentyfourteen
 theme, and BuddyPress 1.9.2.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5454>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list