WordPress.org

Make WordPress Core

Ticket #21195: 21195-param.diff

File 21195-param.diff, 1.5 KB (added by cliffseal, 8 years ago)

Add parameter to get_avatar

  • pluggable.php

     
    15861586 * @param string $alt Alternative text to use in image tag. Defaults to blank
    15871587 * @return string <img> tag for the user's avatar
    15881588*/
    1589 function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) {
     1589function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false, $url = false ) {
    15901590        if ( ! get_option('show_avatars') )
    15911591                return false;
    15921592
     
    16651665                if ( !empty( $rating ) )
    16661666                        $out .= "&amp;r={$rating}";
    16671667
    1668                 $avatar = "<img alt='{$safe_alt}' src='{$out}' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' />";
     1668        if ( $url )
     1669            $avatar = $out;
     1670        else
     1671                    $avatar = "<img alt='{$safe_alt}' src='{$out}' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' />";
    16691672        } else {
    1670                 $avatar = "<img alt='{$safe_alt}' src='{$default}' class='avatar avatar-{$size} photo avatar-default' height='{$size}' width='{$size}' />";
     1673        if ( $url )
     1674            $avatar = $default;
     1675        else
     1676                    $avatar = "<img alt='{$safe_alt}' src='{$default}' class='avatar avatar-{$size} photo avatar-default' height='{$size}' width='{$size}' />";
    16711677        }
    16721678
    1673         return apply_filters('get_avatar', $avatar, $id_or_email, $size, $default, $alt);
     1679        return apply_filters('get_avatar', $avatar, $id_or_email, $size, $default, $alt, $url);
    16741680}
    16751681endif;
    16761682