User Profile Picture - Version 1.0.2

Version Description

  • Bug fix: Error being shown in comment section
Download this release

Release Info

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

Code changes from version 1.0.1 to 1.0.2

Files changed (2) hide show
  1. metronet-profile-picture.php +13 -2
  2. readme.txt +4 -1
metronet-profile-picture.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Metronet 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: Metronet
7
- Version: 1.0.1
8
  Requires at least: 3.3
9
  Author URI: http://www.metronet.no
10
  Contributors: ronalfy, metronet
@@ -113,8 +113,18 @@ class Metronet_Profile_Picture {
113
  //Get user data
114
  if ( is_numeric( $id_or_email ) ) {
115
  $user = get_user_by( 'id', ( int )$id_or_email );
116
- } else {
 
 
 
 
 
 
 
 
117
  $user = get_user_by( 'email', $id_or_email );
 
 
118
  }
119
  if ( !$user ) return $avatar;
120
  $user_id = $user->ID;
@@ -130,6 +140,7 @@ class Metronet_Profile_Picture {
130
  'attr' => array( 'alt' => $alt ),
131
  'echo' => false )
132
  );
 
133
  if ( !$custom_avatar ) return $avatar;
134
  return $custom_avatar;
135
  } //end avatar_override
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: Metronet
7
+ Version: 1.0.2
8
  Requires at least: 3.3
9
  Author URI: http://www.metronet.no
10
  Contributors: ronalfy, metronet
113
  //Get user data
114
  if ( is_numeric( $id_or_email ) ) {
115
  $user = get_user_by( 'id', ( int )$id_or_email );
116
+ } elseif( is_object( $id_or_email ) ) {
117
+ $comment = $id_or_email;
118
+ if ( empty( $comment->user_id ) ) {
119
+ $user = get_user_by( 'id', $comment->user_id );
120
+ } else {
121
+ $user = get_user_by( 'email', $comment->comment_author_email );
122
+ }
123
+ if ( !$user ) return $avatar;
124
+ } elseif( is_string( $id_or_email ) ) {
125
  $user = get_user_by( 'email', $id_or_email );
126
+ } else {
127
+ return $avatar;
128
  }
129
  if ( !$user ) return $avatar;
130
  $user_id = $user->ID;
140
  'attr' => array( 'alt' => $alt ),
141
  'echo' => false )
142
  );
143
+
144
  if ( !$custom_avatar ) return $avatar;
145
  return $custom_avatar;
146
  } //end avatar_override
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: metronet, ronalfy
3
  Tags: users, user, user profile
4
  Requires at least: 3.3
5
  Tested up to: 3.4
6
- Stable tag: 1.0.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -67,6 +67,9 @@ We highly recommend the <a href='http://wordpress.org/extend/plugins/post-thumbn
67
 
68
  == Changelog ==
69
 
 
 
 
70
  = 1.0.1 =
71
  * Bug fix: Not able to "uncheck" Override Avatar.
72
  * Bug fix: Deleting profile image and not reverting to normal avatar.
3
  Tags: users, user, user profile
4
  Requires at least: 3.3
5
  Tested up to: 3.4
6
+ Stable tag: 1.0.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
67
 
68
  == Changelog ==
69
 
70
+ = 1.0.2 =
71
+ * Bug fix: Error being shown in comment section
72
+
73
  = 1.0.1 =
74
  * Bug fix: Not able to "uncheck" Override Avatar.
75
  * Bug fix: Deleting profile image and not reverting to normal avatar.