User Profile Picture - Version 2.2.7

Version Description

  • Released 2019-06-11
  • Fixing permissions in REST API
Download this release

Release Info

Developer ronalfy
Plugin Icon 128x128 User Profile Picture
Version 2.2.7
Comparing to
See all releases

Code changes from version 2.2.6 to 2.2.7

Files changed (2) hide show
  1. metronet-profile-picture.php +14 -13
  2. readme.txt +9 -2
metronet-profile-picture.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: User Profile Picture
4
  Plugin URI: http://wordpress.org/extend/plugins/metronet-profile-picture/
5
  Description: Use the native WP uploader on your user profile page.
6
  Author: Ronald Huereca
7
- Version: 2.2.6
8
  Requires at least: 3.5
9
  Author URI: https://www.mediaron.com
10
  Contributors: ronalfy
@@ -12,7 +12,7 @@ Text Domain: metronet-profile-picture
12
  Domain Path: /languages
13
  */
14
 
15
- define( 'METRONET_PROFILE_PICTURE_VERSION', '2.2.6' );
16
 
17
  /**
18
  * Main Class for User Profile Picture
@@ -850,15 +850,13 @@ class Metronet_Profile_Picture {
850
  if ( ! $user_id ) {
851
  return new WP_Error( 'mpp_no_user', __( 'User not found.', 'metronet-profile-picture' ), array( 'status' => 403 ) );
852
  }
853
- if ( ! current_user_can( 'edit_others_posts' ) ) {
854
  return new WP_Error( 'mpp_not_privs', __( 'You must have a role of editor or above to set a new profile image.', 'metronet-profile-picture' ), array( 'status' => 403 ) );
855
- } else {
856
- $is_post_owner = ( get_post( $media_id )->post_author === $user_id ) ? true : false;
857
- if ( ! $is_post_owner ) {
858
- return new WP_Error( 'mpp_not_owner', __( 'User not owner.', 'metronet-profile-picture' ), array( 'status' => 403 ) );
859
- }
860
  }
861
-
 
 
 
862
 
863
  $post_id = $this->get_post_id( $user_id );
864
  //Save user meta
@@ -870,10 +868,13 @@ class Metronet_Profile_Picture {
870
  $attachment_url = wp_get_attachment_url( $media_id );
871
 
872
  return array(
873
- '24' => wp_get_attachment_image_url( $media_id, 'profile_24', false, '' ),
874
- '48' => wp_get_attachment_image_url( $media_id, 'profile_48', false, '' ),
875
- '96' => wp_get_attachment_image_url( $media_id, 'profile_96', false, '' ),
876
- 'full' => $attachment_url,
 
 
 
877
  );
878
  }
879
 
4
  Plugin URI: http://wordpress.org/extend/plugins/metronet-profile-picture/
5
  Description: Use the native WP uploader on your user profile page.
6
  Author: Ronald Huereca
7
+ Version: 2.2.7
8
  Requires at least: 3.5
9
  Author URI: https://www.mediaron.com
10
  Contributors: ronalfy
12
  Domain Path: /languages
13
  */
14
 
15
+ define( 'METRONET_PROFILE_PICTURE_VERSION', '2.2.7' );
16
 
17
  /**
18
  * Main Class for User Profile Picture
850
  if ( ! $user_id ) {
851
  return new WP_Error( 'mpp_no_user', __( 'User not found.', 'metronet-profile-picture' ), array( 'status' => 403 ) );
852
  }
853
+ if ( ! current_user_can( 'edit_others_posts', $user_id ) ) {
854
  return new WP_Error( 'mpp_not_privs', __( 'You must have a role of editor or above to set a new profile image.', 'metronet-profile-picture' ), array( 'status' => 403 ) );
 
 
 
 
 
855
  }
856
+ $is_post_owner = ( get_post( $media_id )->post_author === $user_id ) ? true : false;
857
+ if ( ! $is_post_owner && ! current_user_can( 'edit_others_posts', $user_id ) ) {
858
+ return new WP_Error( 'mpp_not_owner', __( 'User not owner.', 'metronet-profile-picture' ), array( 'status' => 403 ) );
859
+ }
860
 
861
  $post_id = $this->get_post_id( $user_id );
862
  //Save user meta
868
  $attachment_url = wp_get_attachment_url( $media_id );
869
 
870
  return array(
871
+ '24' => wp_get_attachment_image_url( $media_id, 'profile_24', false, '' ),
872
+ '48' => wp_get_attachment_image_url( $media_id, 'profile_48', false, '' ),
873
+ '96' => wp_get_attachment_image_url( $media_id, 'profile_96', false, '' ),
874
+ '150' => wp_get_attachment_image_url( $media_id, 'profile_150', false, '' ),
875
+ '300' => wp_get_attachment_image_url( $media_id, 'profile_300', false, '' ),
876
+ 'thumbnail' => wp_get_attachment_image_url( $media_id, 'thumbnail', false, '' ),
877
+ 'full' => $attachment_url,
878
  );
879
  }
880
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: ronalfy, Alaadiaa
3
  Tags: users, user profile, gravatar, avatar, blocks, block
4
  Requires at least: 3.5
5
  Tested up to: 5.2
6
- Stable tag: 2.2.6
7
- Requires PHP: 5.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  Donate link: https://mediaron.com/give/
@@ -124,6 +124,10 @@ Yes, but you'll have to set a new profile image per site. This is currently a l
124
 
125
  == Changelog ==
126
 
 
 
 
 
127
  = 2.2.6 =
128
  * Released 2019-06-10
129
  * Fixing permissions in REST API
@@ -303,6 +307,9 @@ Yes, but you'll have to set a new profile image per site. This is currently a l
303
 
304
  == Upgrade Notice ==
305
 
 
 
 
306
  = 2.2.6 =
307
  Fixing permissions in REST API.
308
 
3
  Tags: users, user profile, gravatar, avatar, blocks, block
4
  Requires at least: 3.5
5
  Tested up to: 5.2
6
+ Stable tag: 2.2.7
7
+ Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  Donate link: https://mediaron.com/give/
124
 
125
  == Changelog ==
126
 
127
+ = 2.2.7 =
128
+ * Released 2019-06-11
129
+ * Fixing permissions in REST API
130
+
131
  = 2.2.6 =
132
  * Released 2019-06-10
133
  * Fixing permissions in REST API
307
 
308
  == Upgrade Notice ==
309
 
310
+ = 2.2.7 =
311
+ Fixing permissions in REST API.
312
+
313
  = 2.2.6 =
314
  Fixing permissions in REST API.
315