id || 'user-edit' == get_current_screen() ->id ) { wp_enqueue_script('jquery'); wp_enqueue_script('thickbox'); wp_enqueue_style('thickbox'); wp_enqueue_script('media-upload'); wp_enqueue_script('easy-author-image-uploader'); } } add_action('admin_enqueue_scripts', 'q_enqueue_backend_scripts'); function easy_author_image_init() { global $pagenow; if ( 'media-upload.php' == $pagenow || 'async-upload.php' == $pagenow ) { add_filter( 'gettext', 'q_replace_thickbox_button_text', 1, 3 ); // here we call our func to replace the button text for the avatar uploader } } // Initialize the options add_action('admin_init', 'easy_author_image_init'); // Here we grab the css for the elements in our admin page function q_plugin_styles() { wp_register_style('easy_author_image', plugins_url('css/easy-author-image.css', __FILE__)); wp_enqueue_style('easy_author_image'); } add_action('wp_enqueue_scripts', 'q_plugin_styles'); // First, we'll add a special filter to change the text of the image uploader text when we're uploading an avatar function q_replace_thickbox_button_text($translated_text, $text, $domain) { if ('Insert into Post' == $text) { $referer = strpos( wp_get_referer(), 'profile' ); if ( $referer != '' ) { return __('Make this my author profile picture!', 'q' ); } } return $translated_text; } function q_add_custom_profile_fields( $user ) { // Display image uploader button $avatar = get_the_author_meta( 'author_profile_picture', $user->ID ); ?>

Profile Picture

You can update the picture from above.
?
This profile does not yet have an image. Click the button above to upload one (or select one from your media gallery).
'; echo $output; } function get_author_image_url($user_id=999999) { if($user_id==999999){ $avatar = get_the_author_meta('author_profile_picture', get_the_ID()); } else { $avatar = get_the_author_meta('author_profile_picture', $user_id); } return $avatar; } function get_easy_author_image($avatar, $id_or_email, $size, $default='', $alt='') { // if this plugin is activated, we'll assume the author wants to use their Author Profile Image instead of Gravatar. // This will replace it. // FUTURE RELEASE: ALLOW USER TO SET MAX WIDTH HEIGHT VIA DISCUSSION SCREEN $myavatar = ""; if ( is_numeric($id_or_email) ) { $id = (int) $id_or_email; $user = get_userdata($id); if ( $user ) $email = $user->user_email; } elseif ( is_object($id_or_email) ) { if ( !empty($id_or_email->user_id) ) { $id = (int) $id_or_email->user_id; $user = get_userdata($id); if ( $user) $email = $user->user_email; } elseif ( !empty($id_or_email->comment_author_email) ) { $email = $id_or_email->comment_author_email; } } else { $email = $id_or_email; } // First see if they're a registered user with email set if(!empty($email)) { // user exists + has email $avatar_user = get_user_by('email', $email); // check if author_profile_picture is set $url = get_the_author_meta('author_profile_picture', $avatar_user->ID); if($avatar_user && $url){ // there is a url so user has an author profile picture $myavatar = ''; } else { // No author_profile_picture set OR user does not belong to blog, so default to Gravatar $gravatarUrl = "http://www.gravatar.com/avatar.php?gravatar_id=" . md5($email) . "&size=40"; $myavatar = ".$email."; } }else{ $myavatar = ""; } return $myavatar; } add_filter( 'get_avatar', 'get_easy_author_image', 10, 5); ?>