From 1b6a79f981799801b69bfcf543b308554df841c6 Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Fri, 18 Mar 2022 15:23:33 +0530 Subject: [PATCH] Release 1.2 --- easy-author-avatar-image.php | 76 +++++++++++++++++----------------- js/easy-author-avatar-image.js | 3 ++ readme.txt | 24 ++++++++--- 3 files changed, 59 insertions(+), 44 deletions(-) diff --git a/easy-author-avatar-image.php b/easy-author-avatar-image.php index d0b873c..8b03809 100644 --- a/easy-author-avatar-image.php +++ b/easy-author-avatar-image.php @@ -2,7 +2,7 @@ /* Plugin Name: Easy Author Avatar Image Description: Upload an author image right from your profile page with the click of a button -Version: 1.0 +Version: 1.2 Author: Mukesh Panchal Author URI: https://mukeshpanchal27.com/ Text Domain: easy-author-avatar-image @@ -15,7 +15,7 @@ class easy_author_avatar_image { public function __construct() { $this->plugin_name = 'easy-author-avatar-image'; - $this->version = '1.0'; + $this->version = '1.2'; register_setting( 'easy_author_avatar_image_settings', 'easy_author_avatar_image_option' ); add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_styles_scripts' ] ); add_action( 'show_user_profile', [ $this, 'admin_author_img_upload' ] ); @@ -33,7 +33,6 @@ public function enqueue_styles_scripts() { if ( $easy_author_avatar_image_option_set ) { wp_enqueue_style( $this->plugin_name, plugin_dir_url(__FILE__) . 'css/easy-author-avatar-image.css', array(), $this->version, 'all' ); - wp_enqueue_media(); @@ -66,34 +65,34 @@ public function admin_menu_page() { public function easy_author_avatar_image_page_callback() { ?>
- - - - - - - - -
- - -
- - - - - - -
-
- -
+ + + + + + + + +
+ + +
+ + + + + + +
+
+ + ID, 'easy-author-avatar-profile-image', true ); $avatar_url = wp_get_attachment_image_url( $avatar ); - $button_class = ''; - if ( ! $avatar_url ) { - $button_class = ' easy-author-avatar-image-hide'; - } + $button_class = ( ! $avatar_url ) ? ' easy-author-avatar-image-hide': ""; ?>
@@ -159,13 +155,17 @@ public function get_easy_author_image( $avatar, $id_or_email, $size, $default, $ $user = false; if ( is_numeric( $id_or_email ) ) { + $id = (int) $id_or_email; - $user = get_user_by( 'id', $id ); + $user = get_user_by( 'id' , $id ); + } elseif ( is_object( $id_or_email ) ) { - if ( !empty( $id_or_email->user_id ) ) { + + if ( ! empty( $id_or_email->user_id ) ) { $id = (int) $id_or_email->user_id; - $user = get_user_by( 'id', $id ); + $user = get_user_by( 'id' , $id ); } + } else { $user = get_user_by( 'email', $id_or_email ); } diff --git a/js/easy-author-avatar-image.js b/js/easy-author-avatar-image.js index 0dcc8d6..352a92f 100644 --- a/js/easy-author-avatar-image.js +++ b/js/easy-author-avatar-image.js @@ -18,6 +18,9 @@ uploader = wp.media.frames.file_frame = wp.media({ title: easy_author_avatar_image._media_title, + library: { + type: 'image' + }, button: { text: easy_author_avatar_image._media_button_title }, diff --git a/readme.txt b/readme.txt index 9382b40..d9f56f4 100644 --- a/readme.txt +++ b/readme.txt @@ -1,11 +1,11 @@ === Easy Author Avatar Image === Contributors: mukesh27, dhavalpanchal -Tags: avatar, user profile, gravatar,custom profile photo, custom profile picture, profile photo, profile picture, author image, author photo +Tags: avatar, user profile, gravatar, custom profile photo, custom profile picture, profile photo, profile picture, author image, author photo Donate link: https://www.paypal.com/paypalme/mukeshpanchal27 Requires at least: 5.6 Tested up to: 5.9 Requires PHP: 7.0 -Stable tag: 1.0 +Stable tag: 1.2 License: GPL-2.0+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt @@ -13,13 +13,13 @@ Upload an author image right from your profile page with the click of a button. == Description == -Easy Author Avatar Image gives you the option do you exactly that -- easily add an author image to your profile page. Once you install this plugin, you'll have a new option in the Your Profile tab (under Users) called Profile Picture, complete with a media uploader box that allows you to upload your very own author picture. +Easy Author Avatar Image gives you the option do you exactly that -- easily add an author image to your profile page. Once you install this plugin, you'll have a new option in the Your Profile tab (under Users) called Profile Picture, complete with a media upload box that allows you to upload your very own author picture. Whether you call it an avatar, an author image, or an author picture, Easy Author Avatar Image is a "Works Out Of The Box" solution to a common problem. = What's Next = -If you find this plugin useful , please leave a good rating and consider checking out my other plugins: +If you find this plugin useful, please leave a good rating and consider checking out my other plugins: * Enhanced Comment Validation - Setup a comment validation for comment form. @@ -67,11 +67,23 @@ In addition, if you like the plugin then I'd love for you to leave a review. Tel 3. Upload Custom Avatar Image == Changelog == += 1.2 = +* Fixed: Frontend warning message for avatar image. + += 1.1 = +* Added: Added compatibility for latest WordPress version of 5.9.1 +* Fixed: Allow only image in Media selection. Props @ravipatel. +* Fixed: Optimize some codes. = 1.0 = -* Released. +* Initial release. == Upgrade Notice == += 1.2 = +* Fixed: Frontend warning message for avatar image. + += 1.1 = +Check latest WP version compatibility and allow only image in media upload. = 1.0 = -* Initial version \ No newline at end of file +Initial release. \ No newline at end of file