Skip to:
Content

BuddyPress.org

Changeset 5762


Ignore:
Timestamp:
02/13/2012 08:02:41 AM (13 years ago)
Author:
johnjamesjacoby
Message:

Move bp_get_user_has_avatar() into bp-core-avatars.php and add comparison to bp_core_avatar_default(). Fixes #3977. Props r-a-y, paulgibbs.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-avatars.php

    r5729 r5762  
    796796
    797797/**
     798 * Check if a given user ID has an uploaded avatar
     799 *
     800 * @since BuddyPress (1.0)
     801 * @param int $user_id
     802 * @return boolean
     803 */
     804function bp_get_user_has_avatar( $user_id = 0 ) {
     805
     806    if ( empty( $user_id ) )
     807        $user_id = bp_displayed_user_id();
     808
     809    $retval = false;
     810    if ( bp_core_fetch_avatar( array( 'item_id' => $user_id, 'no_grav' => true, 'html' => false ) ) != bp_core_avatar_default() )
     811        $retval = true;
     812
     813    return (bool) apply_filters( 'bp_get_user_has_avatar', $retval, $user_id );
     814}
     815
     816/**
    798817 * Utility function for fetching an avatar dimension setting
    799818 *
  • trunk/bp-xprofile/bp-xprofile-template.php

    r5729 r5762  
    825825    }
    826826
    827 function bp_get_user_has_avatar() {
    828 
    829     if ( !bp_core_fetch_avatar( array( 'item_id' => bp_displayed_user_id(), 'no_grav' => true ) ) )
    830         return false;
    831 
    832     return true;
    833 }
    834 
    835827function bp_edit_profile_button() {
    836828    global $bp;
Note: See TracChangeset for help on using the changeset viewer.