bp_get_signup_avatar( array|string $args = '' )
Get the user avatar during signup.
Description
See also
- bp_core_fetch_avatar(): for description of arguments.
Parameters
- $args
-
(Optional) Array of optional arguments.
- 'size'
(int) Height/weight in pixels. Default: value of bp_core_avatar_full_width(). - 'class'
(string) CSS class. Default: 'avatar'. - 'alt'
(string) HTML 'alt' attribute. Default: 'Your Avatar'.
Default value: ''
- 'size'
Return
(string)
Source
File: bp-members/bp-members-template.php
function bp_get_signup_avatar( $args = '' ) { $bp = buddypress(); $defaults = array( 'size' => bp_core_avatar_full_width(), 'class' => 'avatar', 'alt' => __( 'Your Profile Photo', 'buddyboss' ) ); $r = wp_parse_args( $args, $defaults ); extract( $r, EXTR_SKIP ); // Avatar DIR is found. if ( $signup_avatar_dir = bp_get_signup_avatar_dir_value() ) { $gravatar_img = bp_core_fetch_avatar( array( 'item_id' => $signup_avatar_dir, 'object' => 'signup', 'avatar_dir' => 'avatars/signups', 'type' => 'full', 'width' => $size, 'height' => $size, 'alt' => $alt, 'class' => $class ) ); // No avatar DIR was found. } else { // Set default gravatar type. if ( empty( $bp->grav_default->user ) ) $default_grav = 'wavatar'; elseif ( 'mystery' == $bp->grav_default->user ) $default_grav = $bp->plugin_url . 'bp-core/images/mystery-man.jpg'; else $default_grav = $bp->grav_default->user; /** * Filters the base Gravatar url used for signup avatars when no avatar dir found. * * @since BuddyPress 1.0.2 * * @param string $value Gravatar url to use. */ $gravatar_url = apply_filters( 'bp_gravatar_url', '//www.gravatar.com/avatar/' ); $md5_lcase_email = md5( strtolower( bp_get_signup_email_value() ) ); $gravatar_img = '<img src="' . $gravatar_url . $md5_lcase_email . '?d=' . $default_grav . '&s=' . $size . '" width="' . $size . '" height="' . $size . '" alt="' . $alt . '" class="' . $class . '" />'; } /** * Filters the user avatar during signup. * * @since BuddyPress 1.1.0 * * @param string $gravatar_img Avatar HTML image tag. * @param array $args Array of parsed args for avatar query. */ return apply_filters( 'bp_get_signup_avatar', $gravatar_img, $args ); }
Changelog
Version | Description |
---|---|
BuddyPress 1.1.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.