bp_get_member_avatar

Get a member's avatar.

Description

(string) bp_get_member_avatar( (string) $args = '' ); 

Returns (string)

User avatar string.

Parameters (1)

0. $args — Optional. (string) => ''
The args.

Options

    ;        


    Usage

    1. if ( !function_exists( 'bp_get_member_avatar' ) ) { 
    2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-members/bp-members-template.php'; 
    3.  
    4. // The args. 
    5. $args = ''; 
    6.  
    7. // NOTICE! Understand what this does before running. 
    8. $result = bp_get_member_avatar($args); 
    9.  

    Defined (1)

    The function is defined in the following location(s).

    /bp-members/bp-members-template.php  
    1. function bp_get_member_avatar( $args = '' ) { 
    2. global $members_template; 
    3.  
    4. $fullname = !empty( $members_template->member->fullname ) ? $members_template->member->fullname : $members_template->member->display_name; 
    5.  
    6. $defaults = array( 
    7. 'type' => 'thumb',  
    8. 'width' => false,  
    9. 'height' => false,  
    10. 'class' => 'avatar',  
    11. 'id' => false,  
    12. 'alt' => sprintf( __( 'Profile picture of %s', buddypress ), $fullname ) 
    13. ); 
    14.  
    15. $r = wp_parse_args( $args, $defaults ); 
    16. extract( $r, EXTR_SKIP ); 
    17.  
    18. /** 
    19. * Filters a members avatar. 
    20. * @since 1.2.0 
    21. * @since 2.6.0 Added the `$r` parameter. 
    22. * @param string $value Formatted HTML <img> element, or raw avatar URL based on $html arg. 
    23. * @param array $r Array of parsed arguments. See {@link bp_get_member_avatar()}. 
    24. */ 
    25. return apply_filters( 'bp_get_member_avatar', bp_core_fetch_avatar( array( 'item_id' => $members_template->member->id, 'type' => $type, 'alt' => $alt, 'css_id' => $id, 'class' => $class, 'width' => $width, 'height' => $height, 'email' => $members_template->member->user_email ) ), $r );