updated plugin `Simple Local Avatars` version 2.7.1

This commit is contained in:
KawaiiPunk 2022-12-19 23:08:22 +00:00 committed by Gitium
parent 7b2202370c
commit db68484a59
3 changed files with 44 additions and 13 deletions

View File

@ -100,6 +100,7 @@ class Simple_Local_Avatars {
*/ */
public function add_hooks() { public function add_hooks() {
global $pagenow; global $pagenow;
global $wp_version;
add_filter( 'plugin_action_links_' . SLA_PLUGIN_BASENAME, array( $this, 'plugin_filter_action_links' ) ); add_filter( 'plugin_action_links_' . SLA_PLUGIN_BASENAME, array( $this, 'plugin_filter_action_links' ) );
@ -133,7 +134,11 @@ class Simple_Local_Avatars {
add_action( 'wp_ajax_sla_clear_user_cache', array( $this, 'sla_clear_user_cache' ) ); add_action( 'wp_ajax_sla_clear_user_cache', array( $this, 'sla_clear_user_cache' ) );
add_filter( 'avatar_defaults', array( $this, 'add_avatar_default_field' ) ); add_filter( 'avatar_defaults', array( $this, 'add_avatar_default_field' ) );
add_action( 'wpmu_new_blog', array( $this, 'set_defaults' ) ); if ( version_compare( $wp_version, '5.1', '<' ) ) {
add_action( 'wpmu_new_blog', array( $this, 'set_defaults' ) );
} else {
add_action( 'wp_initialize_site', array( $this, 'set_defaults' ) );
}
if ( 'profile.php' === $pagenow ) { if ( 'profile.php' === $pagenow ) {
add_filter( 'media_view_strings', function ( $strings ) { add_filter( 'media_view_strings', function ( $strings ) {
@ -142,6 +147,13 @@ class Simple_Local_Avatars {
return $strings; return $strings;
}, 10, 1 ); }, 10, 1 );
} }
// Fix: An error occurred cropping the image (https://github.com/10up/simple-local-avatars/issues/141).
if ( isset( $_POST['action'] ) && 'crop-image' === $_POST['action'] && is_admin() && wp_doing_ajax() ) {
add_action( 'plugins_loaded', function () {
remove_all_actions( 'setup_theme' );
} );
}
} }
/** /**
@ -1233,13 +1245,17 @@ class Simple_Local_Avatars {
/** /**
* Set plugin defaults for a new site * Set plugin defaults for a new site
* *
* @param int $blog_id Blog ID. * @param int|WP_Site $blog_id Blog ID or object.
*/ */
public function set_defaults( $blog_id ) { public function set_defaults( $blog_id ) {
if ( 'enforce' === $this->get_network_mode() ) { if ( 'enforce' === $this->get_network_mode() ) {
return; return;
} }
if ( $blog_id instanceof WP_Site ) {
$blog_id = (int) $blog_id->blog_id;
}
switch_to_blog( $blog_id ); switch_to_blog( $blog_id );
update_option( 'simple_local_avatars', $this->sanitize_options( $this->options ) ); update_option( 'simple_local_avatars', $this->sanitize_options( $this->options ) );
restore_current_blog(); restore_current_blog();

View File

@ -3,9 +3,9 @@ Contributors: jakemgold, 10up, thinkoomph, jeffpaul, faisal03
Donate link: https://10up.com/plugins/simple-local-avatars-wordpress/ Donate link: https://10up.com/plugins/simple-local-avatars-wordpress/
Tags: avatar, gravatar, user photos, users, profile Tags: avatar, gravatar, user photos, users, profile
Requires at least: 5.7 Requires at least: 5.7
Tested up to: 6.0 Tested up to: 6.1
Requires PHP: 7.4 Requires PHP: 7.4
Stable tag: 2.6.0 Stable tag: 2.7.1
License: GPLv2 or later License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html License URI: http://www.gnu.org/licenses/gpl-2.0.html
@ -17,12 +17,12 @@ Adds an avatar upload field to user profiles if the current user has media permi
Just edit a user profile, and scroll down to the new "Avatar" field. The plug-in will take care of cropping and sizing! Just edit a user profile, and scroll down to the new "Avatar" field. The plug-in will take care of cropping and sizing!
1. Stores avatars in the "uploads" folder where all of your other media is kept 1. Stores avatars in the "uploads" folder where all of your other media is kept.
1. Has a simple, native interface 2. Has a simple, native interface.
1. Fully supports Gravatar and default avatars if no local avatar is set for the user - but also allows you turn off Gravatar 3. Fully supports Gravatar and default avatars if no local avatar is set for the user - but also allows you turn off Gravatar.
1. Generates the requested avatar size on demand (and stores the new size for efficiency), so it looks great, just like Gravatar! 4. Generates the requested avatar size on demand (and stores the new size for efficiency), so it looks great, just like Gravatar!
1. Lets you decide whether lower privilege users (subscribers, contributors) can upload their own avatar 5. Lets you decide whether lower privilege users (subscribers, contributors) can upload their own avatar.
1. Enables rating of local avatars, just like Gravatar 6. Enables rating of local avatars, just like Gravatar.
== Installation == == Installation ==
@ -41,6 +41,21 @@ You can also use `get_simple_local_avatar()` (with the same arguments) to retrei
== Changelog == == Changelog ==
= 2.7.1 - 2022-12-08 =
* **Added:** Added missing files from the last release and changed the readme file to fix the bullet points and added fullstops.
= 2.7.0 - 2022-12-08 =
* **Added:** Added `Build release zip` GitHub Action (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@faisal-alvi](https://github.com/faisal-alvi) via [#168](https://github.com/10up/simple-local-avatars/pull/168)).
* **Changed:** Set plugin defaults on `wp_initialize_site` instead of deprecated action `wpmu_new_blog` (props [@kadamwhite](https://github.com/kadamwhite), [@faisal-alvi](https://github.com/faisal-alvi) via [#156](https://github.com/10up/simple-local-avatars/pull/156)).
* **Changed:** Support Level from Active to Stable (props [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter) via [#159](https://github.com/10up/simple-local-avatars/pull/159)).
* **Changed:** Build tools: Allow PHPCS installer plugin to run without prompting user (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@jeffpaul](https://github.com/jeffpaul) via [#164](https://github.com/10up/simple-local-avatars/pull/164)).
* **Changed:** WP tested up to version bump to 6.1 (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@faisal-alvi](https://github.com/faisal-alvi) via [#165](https://github.com/10up/simple-local-avatars/pull/165)).
* **Fixed:** Non admin users can not crop avatar (props [@jayedul](https://github.com/jayedul), [@faisal-alvi](https://github.com/faisal-alvi), [@zamanq](https://github.com/zamanq), [@dkotter](https://github.com/dkotter), [@jeffpaul](https://github.com/jeffpaul) via [#155](https://github.com/10up/simple-local-avatars/pull/155)).
* **Security:** Bump `@wordpress/env` from 4.9.0 to 5.2.0 and `got` from 10.7.0 to 11.8.5 (props [@dependabot](https://github.com/dependabot), [@faisal-alvi](https://github.com/faisal-alvi) via [#153](https://github.com/10up/simple-local-avatars/pull/153)).
* **Security:** Bump `loader-utils` from 2.0.2 to 2.0.3 (props [@dependabot](https://github.com/dependabot), [@faisal-alvi](https://github.com/faisal-alvi) via [#160](https://github.com/10up/simple-local-avatars/pull/160)).
* **Security:** Bump `loader-utils` from 2.0.3 to 2.0.4 (props [@dependabot](https://github.com/dependabot), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#162](https://github.com/10up/simple-local-avatars/pull/162)).
* **Security:** Bump `simple-git` from 3.9.0 to 3.15.1 (props [@dependabot](https://github.com/dependabot) via [#176](https://github.com/10up/simple-local-avatars/pull/176)).
= 2.6.0 - 2022-09-13 = = 2.6.0 - 2022-09-13 =
**Note that this release bumps the minimum required version of WordPress from 4.6 to 5.7 and PHP from 5.6 to 7.4.** **Note that this release bumps the minimum required version of WordPress from 4.6 to 5.7 and PHP from 5.6 to 7.4.**
@ -67,7 +82,7 @@ You can also use `get_simple_local_avatar()` (with the same arguments) to retrei
* **Security:** Dev dependency `@wordpress/scripts` upgraded to resolve deeper level dependency security issues. (props [@jeffpaul](https://github.com/jeffpaul), [@faisal-alvi](https://github.com/faisal-alvi), [@cadic](https://github.com/cadic) via [#119](https://github.com/10up/simple-local-avatars/pull/119)). * **Security:** Dev dependency `@wordpress/scripts` upgraded to resolve deeper level dependency security issues. (props [@jeffpaul](https://github.com/jeffpaul), [@faisal-alvi](https://github.com/faisal-alvi), [@cadic](https://github.com/cadic) via [#119](https://github.com/10up/simple-local-avatars/pull/119)).
= 2.3.0 - 2022-04-25 = = 2.3.0 - 2022-04-25 =
* **Added:** Crop screen (props [@jeffpaul](https://github.com/jeffpaul), [@helen](https://github.com/helen), [@ajmaurya99](https://github.com/ajmaurya99), [@Antonio-Lagun](https://github.com/Antonio-Lagun), [@faisal-alvi](https://github.com/faisal-alvi)). * **Added:** Crop screen (props [@jeffpaul](https://github.com/jeffpaul), [@helen](https://github.com/helen), [@ajmaurya99](https://github.com/ajmaurya99), [@Antonio-Laguna](https://github.com/Antonio-Laguna), [@faisal-alvi](https://github.com/faisal-alvi)).
* **Added:** Avatar preview for Subscribers (props [@ankitguptaindia](https://github.com/ankitguptaindia), [@dinhtungdu](https://github.com/dinhtungdu), [@dkotter](https://github.com/dkotter)). * **Added:** Avatar preview for Subscribers (props [@ankitguptaindia](https://github.com/ankitguptaindia), [@dinhtungdu](https://github.com/dinhtungdu), [@dkotter](https://github.com/dkotter)).
* **Added:** More robust multisite support and shared avatar setting (props [@adamsilverstein](https://github.com/adamsilverstein), [@helen](https://github.com/helen), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@faisal-alvi](https://github.com/faisal-alvi), [@holle75](https://github.com/holle75)). * **Added:** More robust multisite support and shared avatar setting (props [@adamsilverstein](https://github.com/adamsilverstein), [@helen](https://github.com/helen), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@faisal-alvi](https://github.com/faisal-alvi), [@holle75](https://github.com/holle75)).
* **Added:** Settings link to plugin action links (props [@rahulsprajapati](https://github.com/rahulsprajapati), [@jeffpaul](https://github.com/jeffpaul), [@iamdharmesh](https://github.com/iamdharmesh)). * **Added:** Settings link to plugin action links (props [@rahulsprajapati](https://github.com/rahulsprajapati), [@jeffpaul](https://github.com/jeffpaul), [@iamdharmesh](https://github.com/iamdharmesh)).

View File

@ -3,7 +3,7 @@
* Plugin Name: Simple Local Avatars * Plugin Name: Simple Local Avatars
* Plugin URI: https://10up.com/plugins/simple-local-avatars-wordpress/ * Plugin URI: https://10up.com/plugins/simple-local-avatars-wordpress/
* Description: Adds an avatar upload field to user profiles. Generates requested sizes on demand, just like Gravatar! Simple and lightweight. * Description: Adds an avatar upload field to user profiles. Generates requested sizes on demand, just like Gravatar! Simple and lightweight.
* Version: 2.6.0 * Version: 2.7.1
* Requires at least: 5.7 * Requires at least: 5.7
* Requires PHP: 7.4 * Requires PHP: 7.4
* Author: Jake Goldman, 10up * Author: Jake Goldman, 10up
@ -20,7 +20,7 @@ define( 'SLA_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
require_once dirname( __FILE__ ) . '/includes/class-simple-local-avatars.php'; require_once dirname( __FILE__ ) . '/includes/class-simple-local-avatars.php';
// Global constants. // Global constants.
define( 'SLA_VERSION', '2.6.0' ); define( 'SLA_VERSION', '2.7.1' );
define( 'SLA_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); define( 'SLA_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
if ( ! defined( 'SLA_IS_NETWORK' ) ) { if ( ! defined( 'SLA_IS_NETWORK' ) ) {