function largo_get_avatar_filter($avatar, $id_or_email, $size, $default, $alt) { $image_src = largo_get_avatar_src($id_or_email, $size); if (!empty($image_src)) { return '<img src="' . $image_src[0] . '" alt="' . $alt . '" width="' . $size . '" height="' . $size . '" class="avatar avatar-' . $size . ' photo" />'; } else { return $avatar; } }
function largo_add_avatar_field($user) { $image_src = largo_get_avatar_src($user->ID, '128'); largo_print_avatar_admin_css(); ?> <h3>User avatar</h3> <table class="form-table"> <tbody> <tr> <th><label for="<?php echo LARGO_AVATAR_INPUT_NAME; ?> "><?php _e('Current avatar', 'largo'); ?> </label></th> <td> <p id="largo-avatar-display"> <?php if (!empty($image_src)) { ?> <img src="<?php echo $image_src[0]; ?> " width="<?php echo $image_src[1]; ?> " height="<?php echo $image_src[2]; ?> " /><br /> <a href="<?php echo get_edit_post_link(largo_get_user_avatar_id($user->ID)); ?> "><?php _e('Edit', 'largo'); ?> </a> | <a id="largo-remove-avatar" href="#"><?php _e('Remove', 'largo'); ?> </a> <?php } if (empty($image_src) && largo_has_gravatar($user->user_email)) { echo get_avatar($user->ID); echo '<br />'; _e('Currently using Gravatar. Change at <a href="http://gravatar.com/">gravatar.com</a> or choose a different image below.', 'largo'); } ?> </p> <p id="largo-avatar-input" <?php if (!empty($image_src)) { ?> style="display:none;"<?php } ?> > <input type="file" name="<?php echo LARGO_AVATAR_INPUT_NAME; ?> " id="<?php echo LARGO_AVATAR_INPUT_NAME; ?> " /> </p> </td> </tr> </tbody> </table> <?php }