'', 'size' => 96, ), $atts ); if ( empty( $atts['email'] ) || ! is_email( $atts['email'] ) ) { return false; } $atts['size'] = intval( $atts['size'] ); if ( 0 > $atts['size'] ) { $atts['size'] = 96; } return get_avatar( $atts['email'], $atts['size'] ); } /** * Display Gravatar profile * * @since 4.5.0 * * @param array $atts Shortcode attributes. * * @uses shortcode_atts() * @uses get_user_by() * @uses is_email() * @uses sanitize_email() * @uses sanitize_user() * @uses set_url_scheme() * @uses wpcom_get_avatar_url() * @uses get_user_attribute() * @uses esc_url() * @uses esc_html() * @uses _e() * * @return string */ function jetpack_gravatar_profile_shortcode( $atts ) { // Give each use of the shortcode a unique ID static $instance = 0; // Process passed attributes $atts = shortcode_atts( array( 'who' => null, ), $atts, 'jetpack_gravatar_profile' ); // Can specify username, user ID, or email address if ( is_numeric( $atts['who'] ) ) { $user = get_user_by( 'id', (int) $atts['who'] ); } elseif ( is_email( $atts['who'] ) ) { $user = get_user_by( 'email', sanitize_email( $atts['who'] ) ); } elseif ( is_string( $atts['who'] ) ) { $user = get_user_by( 'login', sanitize_user( $atts['who'] ) ); } else { $user = false; } // Bail if we don't have a user if ( false === $user ) { return false; } // Render the shortcode $gravatar_url = set_url_scheme( 'http://gravatar.com/' . $user->user_login ); if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) { $avatar_url = wpcom_get_avatar_url( $user->ID, 96 ); $avatar_url = $avatar_url[0]; $user_location = get_user_attribute( $user->ID, 'location' ); } else { $avatar_url = get_avatar_url( $user->user_email, array( 'size' => 96 ) ); $user_location = get_user_meta( $user->ID, 'location', true ); } ob_start(); ?>

display_name ); ?>

description ); ?>