Skip to:
Content

BuddyPress.org

Changeset 3699


Ignore:
Timestamp:
01/11/2011 06:16:21 PM (11 years ago)
Author:
djpaul
Message:

Add filter to allow gravatar lookups to be disabled site-wide. Fixes #2697, props boonebgorges for initial patch.

File:
1 edited

Legend:

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

    r3668 r3699  
    229229
    230230    // Skips gravatar check if $no_grav is passed
    231     if ( !$no_grav ) {
     231    if ( ! apply_filters( 'bp_core_fetch_avatar_no_grav', $no_grav ) ) {
    232232
    233233        // Set gravatar size
     
    266266        $gravatar   = apply_filters( 'bp_gravatar_url', $host ) . md5( strtolower( $email ) ) . '?d=' . $default_grav . '&s=' . $grav_size;
    267267
    268         // Return gravatar wrapped in <img />
    269         if ( true === $html )
    270             return apply_filters( 'bp_core_fetch_avatar', '<img src="' . $gravatar . '" alt="' . esc_attr( $alt ) . '" class="' . esc_attr( $class ) . '"' . $css_id . $html_width . $html_height . $title . ' />', $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir );
    271 
    272         // ...or only return the gravatar URL
    273         else
    274             return apply_filters( 'bp_core_fetch_avatar_url', $gravatar );
    275 
    276268    } else {
    277         return apply_filters( 'bp_core_fetch_avatar', false, $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir );
    278     }
     269        // No avatar was found, and we've been told not to use a gravatar.
     270        $gravatar = apply_filters( "bp_core_default_avatar_$object", BP_PLUGIN_URL . '/bp-core/images/mystery-man.jpg', $params );
     271    }
     272
     273    if ( true === $html )
     274        return apply_filters( 'bp_core_fetch_avatar', '<img src="' . $gravatar . '" alt="' . esc_attr( $alt ) . '" class="' . esc_attr( $class ) . '"' . $css_id . $html_width . $html_height . $title . ' />', $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir );
     275    else
     276        return apply_filters( 'bp_core_fetch_avatar_url', $gravatar );
    279277}
    280278
Note: See TracChangeset for help on using the changeset viewer.