function hma_user_avatar($user_id, $width, $height, $crop = true) { ?> <img src="<?php echo hma_get_avatar($user_id, $width, $height, $crop); ?> " width="<?php echo $width; ?> " height="<?php echo $height; ?> " class="avatar" /> <?php }
/** * Get the avatar URL for the user, at a given size * * @param string|array $size * @return string */ public function get_avatar_url($size) { if (!isset($this->_avatar_urls[serialize($size)])) { $size = wp_parse_args($size); $this->_avatar_urls[serialize($size)] = hma_get_avatar($this->_id, $size['width'], $size['height'], $size['crop']); } return $this->_avatar_urls[serialize($size)]; }
/** * hma_replace_avatar function. * * @param string $avatar * @param mixed $id_or_email * @param int $size * @param string $default * @param string $alt. (default: null) * @todo email verification should use is_email * @return string */ function hma_replace_avatar($avatar, $id_or_email, $size, $default, $alt = null) { // If the default is supplied and an email - don't hook in (as the avatar is handled through wp-admin settings) if (is_string($id_or_email) && strpos($id_or_email, '@') > 0 && $default) { return $avatar; } $user = hma_parse_user($id_or_email); if (!$user) { return $avatar; } $src = hma_get_avatar($user, $size, $size, true, false); if (!$src) { return $avatar; } return '<img alt="' . $alt . '" src="' . $src . '" class="avatar avatar-' . $size . ' photo" height="' . $size . '" width="' . $size . '" />'; }