Skip to:
Content

BuddyPress.org

Ticket #2436: add_url_parameter.diff

File add_url_parameter.diff, 3.8 KB (added by hempsworth, 15 years ago)
  • bp-core/bp-core-templatetags.php

     
    601601                $defaults = array(
    602602                        'type' => 'thumb',
    603603                        'width' => false,
    604                         'height' => false
     604                        'height' => false,
     605                        'url' => false
    605606                );
    606607
    607608                $r = wp_parse_args( $args, $defaults );
    608609                extract( $r, EXTR_SKIP );
    609610
    610                 return apply_filters( 'bp_get_loggedin_user_avatar', bp_core_fetch_avatar( array( 'item_id' => $bp->loggedin_user->id, 'type' => $type, 'width' => $width, 'height' => $height ) ) );
     611                return apply_filters( 'bp_get_loggedin_user_avatar', bp_core_fetch_avatar( array( 'item_id' => $bp->loggedin_user->id, 'type' => $type, 'width' => $width, 'height' => $height, 'url' => $url ) ) );
    611612        }
    612613
    613614function bp_displayed_user_avatar( $args = '' ) {
     
    619620                $defaults = array(
    620621                        'type' => 'thumb',
    621622                        'width' => false,
    622                         'height' => false
     623                        'height' => false,
     624                        'url' => false
    623625                );
    624626
    625627                $r = wp_parse_args( $args, $defaults );
    626628                extract( $r, EXTR_SKIP );
    627629
    628                 return apply_filters( 'bp_get_displayed_user_avatar', bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => $type, 'width' => $width, 'height' => $height ) ) );
     630                return apply_filters( 'bp_get_displayed_user_avatar', bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => $type, 'width' => $width, 'height' => $height, 'url' => $url ) ) );
    629631        }
    630632
    631633function bp_avatar_admin_step() {
  • bp-core/bp-core-avatars.php

     
    6060                'css_id' => false,
    6161                'alt' => __( 'Avatar Image', 'buddypress' ),
    6262                'email' => false, // Pass the user email (for gravatar) to prevent querying the DB for it
    63                 'no_grav' => false // If there is no avatar found, return false instead of a grav?
     63                'no_grav' => false, // If there is no avatar found, return false instead of a grav?
     64                'url' => false // Do we output the image or just the url
    6465        );
    6566
    6667        $params = wp_parse_args( $args, $defaults );
     
    129130                }
    130131                closedir($av_dir);
    131132
    132                 if ( $avatar_url )
     133                if ( $avatar_url && $url )
     134                        return apply_filters( 'bp_core_fetch_avatar', $avatar_url, $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir );
     135                elseif ( $avatar_url )
    133136                        return apply_filters( 'bp_core_fetch_avatar', "<img src='{$avatar_url}' alt='{$alt}' class='{$class}'{$css_id}{$html_width}{$html_height} />", $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir );
    134137        }
    135138
     
    162165                $email = apply_filters( 'bp_core_gravatar_email', $email, $item_id, $object );
    163166                $gravatar = apply_filters( 'bp_gravatar_url', $host ) . md5( $email ) . '?d=' . $default_grav . '&amp;s=' . $grav_size;
    164167
    165                 return apply_filters( 'bp_core_fetch_avatar', "<img src='{$gravatar}' alt='{$alt}' class='{$class}'{$css_id}{$html_width}{$html_height} />", $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir );
     168                if ( $url )
     169                        return apply_filters( 'bp_core_fetch_avatar', $gravatar, $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir );
     170                else
     171                        return apply_filters( 'bp_core_fetch_avatar', "<img src='{$gravatar}' alt='{$alt}' class='{$class}'{$css_id}{$html_width}{$html_height} />", $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir );
    166172        } else {
    167173                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 );
    168174        }