Version Description
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.
Download this release
Release Info
Developer | 10up |
Plugin | Simple Local Avatars |
Version | 2.6.0 |
Comparing to | |
See all releases |
Code changes from version 2.5.0 to 2.6.0
- includes/class-simple-local-avatars.php +40 -3
- readme.txt +18 -5
- simple-local-avatars.php +4 -4
includes/class-simple-local-avatars.php
CHANGED
@@ -426,17 +426,36 @@ class Simple_Local_Avatars {
|
|
426 |
public function get_simple_local_avatar_alt( $id_or_email ) {
|
427 |
$user_id = $this->get_user_id( $id_or_email );
|
428 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
429 |
if ( empty( $user_id ) ) {
|
430 |
-
return
|
431 |
}
|
432 |
|
433 |
// Fetch local avatar from meta and make sure we have a media ID.
|
434 |
$local_avatars = get_user_meta( $user_id, 'simple_local_avatar', true );
|
435 |
if ( empty( $local_avatars['media_id'] ) ) {
|
436 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
437 |
}
|
438 |
|
439 |
-
|
|
|
|
|
440 |
}
|
441 |
|
442 |
/**
|
@@ -934,6 +953,15 @@ class Simple_Local_Avatars {
|
|
934 |
$meta_value['blog_id'] = get_current_blog_id();
|
935 |
|
936 |
update_user_meta( $user_id, $this->user_key, $meta_value ); // save user information (overwriting old).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
937 |
}
|
938 |
|
939 |
/**
|
@@ -1036,6 +1064,15 @@ class Simple_Local_Avatars {
|
|
1036 |
|
1037 |
$this->avatar_delete( $user_id ); // delete old images if successful
|
1038 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1039 |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
1040 |
echo wp_kses_post( get_simple_local_avatar( $user_id ) );
|
1041 |
}
|
426 |
public function get_simple_local_avatar_alt( $id_or_email ) {
|
427 |
$user_id = $this->get_user_id( $id_or_email );
|
428 |
|
429 |
+
/**
|
430 |
+
* Filter the default avatar alt text.
|
431 |
+
*
|
432 |
+
* @param string $alt Default alt text.
|
433 |
+
* @return string
|
434 |
+
*/
|
435 |
+
$default_alt = apply_filters( 'simple_local_avatars_default_alt', __( 'Avatar photo', 'simple-local-avatars' ) );
|
436 |
+
|
437 |
if ( empty( $user_id ) ) {
|
438 |
+
return $default_alt;
|
439 |
}
|
440 |
|
441 |
// Fetch local avatar from meta and make sure we have a media ID.
|
442 |
$local_avatars = get_user_meta( $user_id, 'simple_local_avatar', true );
|
443 |
if ( empty( $local_avatars['media_id'] ) ) {
|
444 |
+
$alt = '';
|
445 |
+
// If no avatar is set, check if we are using a default avatar with alt text.
|
446 |
+
if ( 'simple_local_avatar' === get_option( 'avatar_default' ) ) {
|
447 |
+
$default_avatar_id = get_option( 'simple_local_avatar_default', '' );
|
448 |
+
if ( ! empty( $default_avatar_id ) ) {
|
449 |
+
$alt = get_post_meta( $default_avatar_id, '_wp_attachment_image_alt', true );
|
450 |
+
}
|
451 |
+
}
|
452 |
+
|
453 |
+
return $alt ? $alt : $default_alt;
|
454 |
}
|
455 |
|
456 |
+
$alt = get_post_meta( $local_avatars['media_id'], '_wp_attachment_image_alt', true );
|
457 |
+
|
458 |
+
return $alt ? $alt : $default_alt;
|
459 |
}
|
460 |
|
461 |
/**
|
953 |
$meta_value['blog_id'] = get_current_blog_id();
|
954 |
|
955 |
update_user_meta( $user_id, $this->user_key, $meta_value ); // save user information (overwriting old).
|
956 |
+
|
957 |
+
/**
|
958 |
+
* Enable themes and other plugins to react to changes to a user's avatar.
|
959 |
+
*
|
960 |
+
* @since 2.6.0
|
961 |
+
*
|
962 |
+
* @param int $user_id Id of the user who's avatar was updated
|
963 |
+
*/
|
964 |
+
do_action( 'simple_local_avatar_updated' , $user_id );
|
965 |
}
|
966 |
|
967 |
/**
|
1064 |
|
1065 |
$this->avatar_delete( $user_id ); // delete old images if successful
|
1066 |
|
1067 |
+
/**
|
1068 |
+
* Enable themes and other plugins to react to avatar deletions.
|
1069 |
+
*
|
1070 |
+
* @since 2.6.0
|
1071 |
+
*
|
1072 |
+
* @param int $user_id Id of the user who's avatar was deleted.
|
1073 |
+
*/
|
1074 |
+
do_action( 'simple_local_avatar_deleted', $user_id );
|
1075 |
+
|
1076 |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
1077 |
echo wp_kses_post( get_simple_local_avatar( $user_id ) );
|
1078 |
}
|
readme.txt
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
Contributors: jakemgold, 10up, thinkoomph, jeffpaul, faisal03
|
3 |
Donate link: https://10up.com/plugins/simple-local-avatars-wordpress/
|
4 |
Tags: avatar, gravatar, user photos, users, profile
|
5 |
-
Requires at least:
|
6 |
Tested up to: 6.0
|
7 |
-
Requires PHP:
|
8 |
-
Stable tag: 2.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -21,7 +21,7 @@ Just edit a user profile, and scroll down to the new "Avatar" field. The plug-in
|
|
21 |
1. Has a simple, native interface
|
22 |
1. Fully supports Gravatar and default avatars if no local avatar is set for the user - but also allows you turn off Gravatar
|
23 |
1. Generates the requested avatar size on demand (and stores the new size for efficiency), so it looks great, just like Gravatar!
|
24 |
-
1.
|
25 |
1. Enables rating of local avatars, just like Gravatar
|
26 |
|
27 |
== Installation ==
|
@@ -41,6 +41,16 @@ You can also use `get_simple_local_avatar()` (with the same arguments) to retrei
|
|
41 |
|
42 |
== Changelog ==
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
= 2.5.0 - 2022-06-24 =
|
45 |
* **Added:** Skip cropping button (props [@dkotter](https://github.com/dkotter), [@faisal-alvi](https://github.com/faisal-alvi), [@cadic](https://github.com/cadic), [@jeffpaul](https://github.com/jeffpaul), [@dinhtungdu](https://github.com/dinhtungdu) via [#130](https://github.com/10up/simple-local-avatars/pull/130))!
|
46 |
* **Added:** Updated the button name from "Skip Crop" to "Default Crop" only on the edit profile page (props [@faisal-alvi](https://github.com/faisal-alvi), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#136](https://github.com/10up/simple-local-avatars/pull/136)).
|
@@ -163,6 +173,9 @@ You can also use `get_simple_local_avatar()` (with the same arguments) to retrei
|
|
163 |
|
164 |
== Upgrade Notice ==
|
165 |
|
|
|
|
|
|
|
166 |
= 2.1 =
|
167 |
*Important note:* All avatar uploads now go into the media library. Don't worry - users without the ability to upload files cannot otherwise see the contents of your media library. This allows local avatars to respect other functionality your site may have around uploaded images, such as external hosting.
|
168 |
|
@@ -170,4 +183,4 @@ You can also use `get_simple_local_avatar()` (with the same arguments) to retrei
|
|
170 |
Upgraded to take advantage of *WordPress 3.5 and newer*. Does not support older versions! This has also *not* been tested with front end profile plug-ins - feedback welcome. Note that several language strings have been added or modified - revised translations would be welcome!
|
171 |
|
172 |
= 1.3.1 =
|
173 |
-
Like WordPress 3.2, now *REQUIRES* PHP 5.2 or newer.
|
2 |
Contributors: jakemgold, 10up, thinkoomph, jeffpaul, faisal03
|
3 |
Donate link: https://10up.com/plugins/simple-local-avatars-wordpress/
|
4 |
Tags: avatar, gravatar, user photos, users, profile
|
5 |
+
Requires at least: 5.7
|
6 |
Tested up to: 6.0
|
7 |
+
Requires PHP: 7.4
|
8 |
+
Stable tag: 2.6.0
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
21 |
1. Has a simple, native interface
|
22 |
1. Fully supports Gravatar and default avatars if no local avatar is set for the user - but also allows you turn off Gravatar
|
23 |
1. Generates the requested avatar size on demand (and stores the new size for efficiency), so it looks great, just like Gravatar!
|
24 |
+
1. Lets you decide whether lower privilege users (subscribers, contributors) can upload their own avatar
|
25 |
1. Enables rating of local avatars, just like Gravatar
|
26 |
|
27 |
== Installation ==
|
41 |
|
42 |
== Changelog ==
|
43 |
|
44 |
+
= 2.6.0 - 2022-09-13 =
|
45 |
+
**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.**
|
46 |
+
|
47 |
+
* **Added:** If a default avatar image is used, ensure that outputs alt text. This will either be default text (Avatar photo) or the alt text from the uploaded default image (props [@dkotter](https://github.com/dkotter), [@faisal-alvi](https://github.com/faisal-alvi) via [#147](https://github.com/10up/simple-local-avatars/pull/147))
|
48 |
+
* **Added:** Two hooks, `simple_local_avatar_updated` and `simple_local_avatar_deleted`, (props [@t-lock](https://github.com/t-lock), [@faisal-alvi](https://github.com/faisal-alvi), [@dkotter](https://github.com/dkotter) via [#149](https://github.com/10up/simple-local-avatars/pull/149))
|
49 |
+
* **Changed:** Bump minimum required version of WordPress from 4.6 to 5.7 (props [@vikrampm1](https://github.com/vikrampm1), [@faisal-alvi](https://github.com/faisal-alvi), [@cadic](https://github.com/cadic) via [#143](https://github.com/10up/simple-local-avatars/pull/143)).
|
50 |
+
* **Changed:** Bump minimum required version of PHP from 5.6 to 7.4 (props [@vikrampm1](https://github.com/vikrampm1), [@faisal-alvi](https://github.com/faisal-alvi), [@cadic](https://github.com/cadic) via [#143](https://github.com/10up/simple-local-avatars/pull/143)).
|
51 |
+
* **Changed:**The plugin is now available via Composer without any additional steps required (props [@faisal-alvi](https://github.com/faisal-alvi), [@kovshenin](https://github.com/kovshenin), [@jeffpaul](https://github.com/jeffpaul) via [#145](https://github.com/10up/simple-local-avatars/pull/145))
|
52 |
+
* **Security:** Bump `terser` from 5.14.1 to 5.14.2 (props [@dependabot](https://github.com/dependabot), [@faisal-alvi](https://github.com/faisal-alvi) via [#142](https://github.com/10up/simple-local-avatars/pull/142))
|
53 |
+
|
54 |
= 2.5.0 - 2022-06-24 =
|
55 |
* **Added:** Skip cropping button (props [@dkotter](https://github.com/dkotter), [@faisal-alvi](https://github.com/faisal-alvi), [@cadic](https://github.com/cadic), [@jeffpaul](https://github.com/jeffpaul), [@dinhtungdu](https://github.com/dinhtungdu) via [#130](https://github.com/10up/simple-local-avatars/pull/130))!
|
56 |
* **Added:** Updated the button name from "Skip Crop" to "Default Crop" only on the edit profile page (props [@faisal-alvi](https://github.com/faisal-alvi), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#136](https://github.com/10up/simple-local-avatars/pull/136)).
|
173 |
|
174 |
== Upgrade Notice ==
|
175 |
|
176 |
+
= 2.6.0 =
|
177 |
+
**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.**
|
178 |
+
|
179 |
= 2.1 =
|
180 |
*Important note:* All avatar uploads now go into the media library. Don't worry - users without the ability to upload files cannot otherwise see the contents of your media library. This allows local avatars to respect other functionality your site may have around uploaded images, such as external hosting.
|
181 |
|
183 |
Upgraded to take advantage of *WordPress 3.5 and newer*. Does not support older versions! This has also *not* been tested with front end profile plug-ins - feedback welcome. Note that several language strings have been added or modified - revised translations would be welcome!
|
184 |
|
185 |
= 1.3.1 =
|
186 |
+
Like WordPress 3.2, now *REQUIRES* PHP 5.2 or newer.
|
simple-local-avatars.php
CHANGED
@@ -3,9 +3,9 @@
|
|
3 |
* Plugin Name: Simple Local Avatars
|
4 |
* Plugin URI: https://10up.com/plugins/simple-local-avatars-wordpress/
|
5 |
* Description: Adds an avatar upload field to user profiles. Generates requested sizes on demand, just like Gravatar! Simple and lightweight.
|
6 |
-
* Version: 2.
|
7 |
-
* Requires at least:
|
8 |
-
* Requires PHP:
|
9 |
* Author: Jake Goldman, 10up
|
10 |
* Author URI: https://10up.com
|
11 |
* License: GPLv2 or later
|
@@ -20,7 +20,7 @@ define( 'SLA_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
|
20 |
require_once dirname( __FILE__ ) . '/includes/class-simple-local-avatars.php';
|
21 |
|
22 |
// Global constants.
|
23 |
-
define( 'SLA_VERSION', '2.
|
24 |
define( 'SLA_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
25 |
|
26 |
if ( ! defined( 'SLA_IS_NETWORK' ) ) {
|
3 |
* Plugin Name: Simple Local Avatars
|
4 |
* Plugin URI: https://10up.com/plugins/simple-local-avatars-wordpress/
|
5 |
* Description: Adds an avatar upload field to user profiles. Generates requested sizes on demand, just like Gravatar! Simple and lightweight.
|
6 |
+
* Version: 2.6.0
|
7 |
+
* Requires at least: 5.7
|
8 |
+
* Requires PHP: 7.4
|
9 |
* Author: Jake Goldman, 10up
|
10 |
* Author URI: https://10up.com
|
11 |
* License: GPLv2 or later
|
20 |
require_once dirname( __FILE__ ) . '/includes/class-simple-local-avatars.php';
|
21 |
|
22 |
// Global constants.
|
23 |
+
define( 'SLA_VERSION', '2.6.0' );
|
24 |
define( 'SLA_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
25 |
|
26 |
if ( ! defined( 'SLA_IS_NETWORK' ) ) {
|