Custom User Profile Photo - Version 0.5.3

Version Description

  • Addressed an issue where an object being passed into cupp_get_user_by_id_or_email could potentially be the WP_Comment object.
Download this release

Release Info

Developer 3five
Plugin Icon wp plugin Custom User Profile Photo
Version 0.5.3
Comparing to
See all releases

Code changes from version 0.5.2 to 0.5.3

Files changed (2) hide show
  1. 3five_cupp.php +12 -5
  2. readme.txt +11 -2
3five_cupp.php CHANGED
@@ -1,15 +1,15 @@
1
  <?php
2
  /*
3
  Plugin Name: Custom User Profile Photo
4
- Plugin URI: http://3five.com
5
  Description: A simple and effective custom WordPress user profile photo plugin. This plugin leverages the WordPress
6
  Media Uploader functionality. To use this plugin go to the users tab and select a user. The new field can be found
7
  below the password fields for that user.
8
- Author: 3five
9
- Author URI: http://3five.com
10
  Text Domain: custom-user-profile-photo
11
  Domain Path: /languages/
12
- Version: 0.5.2
13
  */
14
 
15
  /**
@@ -288,18 +288,25 @@ add_filter( 'get_avatar', 'cupp_avatar', 1, 5 );
288
  /**
289
  * Get a WordPress User by ID or email
290
  *
291
- * @param int|object|string $identifier User object, UD or email address.
292
  *
293
  * @return WP_User
294
  */
295
  function cupp_get_user_by_id_or_email( $identifier ) {
 
296
  if ( is_numeric( $identifier ) ) {
297
  return get_user_by( 'id', (int) $identifier );
298
  }
299
 
 
300
  if ( is_object( $identifier ) && property_exists( $identifier, 'ID' ) ) {
301
  return get_user_by( 'id', (int) $identifier->ID );
302
  }
303
 
 
 
 
 
 
304
  return get_user_by( 'email', $identifier );
305
  }
1
  <?php
2
  /*
3
  Plugin Name: Custom User Profile Photo
4
+ Plugin URI: http://vincentlistrani.com
5
  Description: A simple and effective custom WordPress user profile photo plugin. This plugin leverages the WordPress
6
  Media Uploader functionality. To use this plugin go to the users tab and select a user. The new field can be found
7
  below the password fields for that user.
8
+ Author: VincentListrani
9
+ Author URI: http://vincentlistrani.com
10
  Text Domain: custom-user-profile-photo
11
  Domain Path: /languages/
12
+ Version: 0.5.3
13
  */
14
 
15
  /**
288
  /**
289
  * Get a WordPress User by ID or email
290
  *
291
+ * @param int|object|string $identifier User object, ID or email address.
292
  *
293
  * @return WP_User
294
  */
295
  function cupp_get_user_by_id_or_email( $identifier ) {
296
+ // If an integer is passed.
297
  if ( is_numeric( $identifier ) ) {
298
  return get_user_by( 'id', (int) $identifier );
299
  }
300
 
301
+ // If the WP_User object is passed.
302
  if ( is_object( $identifier ) && property_exists( $identifier, 'ID' ) ) {
303
  return get_user_by( 'id', (int) $identifier->ID );
304
  }
305
 
306
+ // If the WP_Comment object is passed.
307
+ if ( is_object( $identifier ) && property_exists( $identifier, 'user_id' ) ) {
308
+ return get_user_by( 'id', (int) $identifier->user_id );
309
+ }
310
+
311
  return get_user_by( 'email', $identifier );
312
  }
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Plugin Name ===
2
- Contributors: 3five, VincentListrani, jmichaelward
3
  Donate link:
4
  Tags: custom profile photo, custom profile picture, profile picture, user profile, profile photo, user profile photo, user profile picture
5
  Requires at least: 3.6.1
6
  Tested up to: 4.7.3
7
- Stable tag: 0.5.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -84,6 +84,9 @@ Where the $user_ID is the users ID number and the size is a registered image siz
84
 
85
  == Changelog ==
86
 
 
 
 
87
  = 0.5.2 =
88
  * Fixed issue with a PHP warning when getting the user with the WP_User object.
89
 
@@ -131,6 +134,12 @@ Where the $user_ID is the users ID number and the size is a registered image siz
131
 
132
  == Upgrade Notice ==
133
 
 
 
 
 
 
 
134
  = 0.5.1 =
135
  Fixed issue with update_user_attribute.
136
 
1
  === Plugin Name ===
2
+ Contributors: VincentListrani, jmichaelward
3
  Donate link:
4
  Tags: custom profile photo, custom profile picture, profile picture, user profile, profile photo, user profile photo, user profile picture
5
  Requires at least: 3.6.1
6
  Tested up to: 4.7.3
7
+ Stable tag: 0.5.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
84
 
85
  == Changelog ==
86
 
87
+ = 0.5.3 =
88
+ * Addressed an issue where an object being passed into `cupp_get_user_by_id_or_email` could potentially be the WP_Comment object.
89
+
90
  = 0.5.2 =
91
  * Fixed issue with a PHP warning when getting the user with the WP_User object.
92
 
134
 
135
  == Upgrade Notice ==
136
 
137
+ = 0.5.3 =
138
+ Addressed an issue where an object being passed into `cupp_get_user_by_id_or_email` could potentially be the WP_Comment object.
139
+
140
+ = 0.5.2 =
141
+ Fixed issue with a PHP warning when getting the user with the WP_User object.
142
+
143
  = 0.5.1 =
144
  Fixed issue with update_user_attribute.
145