Skip to:
Content

BuddyPress.org

Changeset 8244


Ignore:
Timestamp:
04/06/2014 04:20:35 PM (10 years ago)
Author:
boonebgorges
Message:

Allow bp_get_group_has_avatar() to accept a group_id param

Also fix some logic that was causing the function to return true when the
group avatar matched the default avatar (meaning that no local avatar had been
uploaded). See r7769

Fixes #5380

Props imath

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups/bp-groups-template.php

    r8168 r8244  
    29012901    }
    29022902
    2903 function bp_get_group_has_avatar() {
     2903function bp_get_group_has_avatar( $group_id = false ) {
    29042904    global $bp;
    29052905
    2906     if ( !empty( $_FILES ) || !bp_core_fetch_avatar( array( 'item_id' => $bp->groups->current_group->id, 'object' => 'group', 'no_grav' => true ) ) )
     2906    if ( false === $group_id ) {
     2907        $group_id = bp_get_current_group_id();
     2908    }
     2909
     2910    // Todo - this looks like an overgeneral check
     2911    if ( ! empty( $_FILES ) ) {
    29072912        return false;
     2913    }
     2914
     2915    $group_avatar = bp_core_fetch_avatar( array(
     2916        'item_id' => $group_id,
     2917        'object' => 'group',
     2918        'no_grav' => true,
     2919        'html' => false,
     2920    ) );
     2921
     2922    if ( bp_core_avatar_default( 'local' ) === $group_avatar ) {
     2923        return false;
     2924    }
    29082925
    29092926    return true;
Note: See TracChangeset for help on using the changeset viewer.