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 ); ?>
| 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). |