WP User Avatar - Version 2.2.9

Version Description

  • Fixed PHP Notice: Trying to get property 'ID' of non-object.
  • Fixed Fatal Error: Cannot use string offset as an array.
  • Fixed: Deprecated: whitelist_options is deprecated since version 5.5.0
  • Increased the priority of user_profile_picture_description filter usage
Download this release

Release Info

Developer Collizo4sky
Plugin Icon 128x128 WP User Avatar
Version 2.2.9
Comparing to
See all releases

Code changes from version 2.2.8 to 2.2.9

includes/class-wp-user-avatar-admin.php CHANGED
@@ -31,7 +31,11 @@ class WP_User_Avatar_Admin {
31
  add_action('admin_init', array($this, 'wpua_register_settings'));
32
  // Default avatar
33
  add_filter('default_avatar_select', array($this, 'wpua_add_default_avatar'), 10);
34
- add_filter('whitelist_options', array($this, 'wpua_whitelist_options'), 10);
 
 
 
 
35
  // Additional plugin info
36
  add_filter('plugin_action_links', array($this, 'wpua_action_links'), 10, 2);
37
  add_filter('plugin_row_meta', array($this, 'wpua_row_meta'), 10, 2);
@@ -42,7 +46,7 @@ class WP_User_Avatar_Admin {
42
  }
43
  // Media states
44
  add_filter('display_media_states', array($this, 'wpua_add_media_state'), 10, 1);
45
-
46
  }
47
 
48
  /**
@@ -51,7 +55,7 @@ class WP_User_Avatar_Admin {
51
  * @uses add_option()
52
  */
53
  public function wpua_options() {
54
-
55
  add_option('avatar_default_wp_user_avatar', "");
56
  add_option('wp_user_avatar_allow_upload', '0');
57
  add_option('wp_user_avatar_disable_gravatar', '0');
@@ -61,7 +65,7 @@ class WP_User_Avatar_Admin {
61
  add_option('wp_user_avatar_resize_upload', '0');
62
  add_option('wp_user_avatar_resize_w', '96');
63
  add_option('wp_user_avatar_tinymce', '1');
64
- add_option('wp_user_avatar_upload_size_limit', '0');
65
 
66
  if(wp_next_scheduled( 'wpua_has_gravatar_cron_hook' )){
67
  $cron=get_option('cron');
@@ -100,7 +104,7 @@ class WP_User_Avatar_Admin {
100
  update_option($wp_user_roles, $user_roles);
101
  // Reset all default avatars to Mystery Man
102
  update_option('avatar_default', 'mystery');
103
-
104
  }
105
 
106
  /**
@@ -293,7 +297,7 @@ class WP_User_Avatar_Admin {
293
  * @param string $file
294
  * @return array $links
295
  */
296
- public function wpua_action_links($links, $file) {
297
  if(basename(dirname($file)) == 'wp-user-avatar') {
298
  $links[] = '<a href="'.esc_url(add_query_arg(array('page' => 'wp-user-avatar'), admin_url('admin.php'))).'">'.__('Settings','wp-user-avatar').'</a>';
299
  }
@@ -373,11 +377,14 @@ class WP_User_Avatar_Admin {
373
  */
374
  public function wpua_add_media_state($states) {
375
  global $post, $wpua_avatar_default;
376
- $is_wpua = get_post_custom_values('_wp_attachment_wp_user_avatar', $post->ID);
 
 
377
  if(!empty($is_wpua)) {
378
  $states[] = __('Profile Picture','wp-user-avatar');
379
  }
380
- if(!empty($wpua_avatar_default) && ($wpua_avatar_default == $post->ID)) {
 
381
  $states[] = __('Default Avatar','wp-user-avatar');
382
  }
383
  /**
@@ -387,7 +394,7 @@ class WP_User_Avatar_Admin {
387
  */
388
  return apply_filters('wpua_add_media_state', $states);
389
  }
390
-
391
  }
392
 
393
  /**
31
  add_action('admin_init', array($this, 'wpua_register_settings'));
32
  // Default avatar
33
  add_filter('default_avatar_select', array($this, 'wpua_add_default_avatar'), 10);
34
+ if (function_exists('add_allowed_options')) {
35
+ add_filter('allowed_options', array($this, 'wpua_whitelist_options'), 10);
36
+ } else {
37
+ add_filter('whitelist_options', array($this, 'wpua_whitelist_options'), 10);
38
+ }
39
  // Additional plugin info
40
  add_filter('plugin_action_links', array($this, 'wpua_action_links'), 10, 2);
41
  add_filter('plugin_row_meta', array($this, 'wpua_row_meta'), 10, 2);
46
  }
47
  // Media states
48
  add_filter('display_media_states', array($this, 'wpua_add_media_state'), 10, 1);
49
+
50
  }
51
 
52
  /**
55
  * @uses add_option()
56
  */
57
  public function wpua_options() {
58
+
59
  add_option('avatar_default_wp_user_avatar', "");
60
  add_option('wp_user_avatar_allow_upload', '0');
61
  add_option('wp_user_avatar_disable_gravatar', '0');
65
  add_option('wp_user_avatar_resize_upload', '0');
66
  add_option('wp_user_avatar_resize_w', '96');
67
  add_option('wp_user_avatar_tinymce', '1');
68
+ add_option('wp_user_avatar_upload_size_limit', '0');
69
 
70
  if(wp_next_scheduled( 'wpua_has_gravatar_cron_hook' )){
71
  $cron=get_option('cron');
104
  update_option($wp_user_roles, $user_roles);
105
  // Reset all default avatars to Mystery Man
106
  update_option('avatar_default', 'mystery');
107
+
108
  }
109
 
110
  /**
297
  * @param string $file
298
  * @return array $links
299
  */
300
+ public function wpua_action_links($links, $file) {
301
  if(basename(dirname($file)) == 'wp-user-avatar') {
302
  $links[] = '<a href="'.esc_url(add_query_arg(array('page' => 'wp-user-avatar'), admin_url('admin.php'))).'">'.__('Settings','wp-user-avatar').'</a>';
303
  }
377
  */
378
  public function wpua_add_media_state($states) {
379
  global $post, $wpua_avatar_default;
380
+
381
+ $is_wpua = isset($post->ID) ? get_post_custom_values('_wp_attachment_wp_user_avatar', $post->ID) : '';
382
+
383
  if(!empty($is_wpua)) {
384
  $states[] = __('Profile Picture','wp-user-avatar');
385
  }
386
+
387
+ if(!empty($wpua_avatar_default) && isset($post->ID) && ($wpua_avatar_default == $post->ID)) {
388
  $states[] = __('Default Avatar','wp-user-avatar');
389
  }
390
  /**
394
  */
395
  return apply_filters('wpua_add_media_state', $states);
396
  }
397
+
398
  }
399
 
400
  /**
includes/class-wp-user-avatar-functions.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Core user functions.
4
- *
5
  * @package WP User Avatar
6
  * @version 2.2.4
7
  */
@@ -23,7 +23,7 @@ class WP_User_Avatar_Functions {
23
  add_filter('bp_core_fetch_avatar', array($this, 'wpua_bp_core_fetch_avatar_filter'), 10, 5);
24
  // Filter to display WP User Avatar by URL at Buddypress
25
  add_filter('bp_core_fetch_avatar_url', array($this, 'wpua_bp_core_fetch_avatar_url_filter'), 10, 5);
26
-
27
  }
28
 
29
 
@@ -58,14 +58,14 @@ class WP_User_Avatar_Functions {
58
  } else if( $wpua_disable_gravatar ) {
59
 
60
  $url = $this->wpua_get_default_avatar_url($url, $id_or_email, $args);
61
-
62
  } else {
63
 
64
  $has_valid_url = $this->wpua_has_gravatar($id_or_email);
65
  if(!$has_valid_url){
66
  $url = $this->wpua_get_default_avatar_url($url, $id_or_email, $args);
67
  }
68
-
69
  }
70
  /**
71
  * Filter get_avatar_url filter
@@ -83,18 +83,18 @@ class WP_User_Avatar_Functions {
83
  function wpua_get_default_avatar_url($url, $id_or_email, $args){
84
 
85
  global $avatar_default, $mustache_admin, $mustache_avatar, $mustache_medium, $mustache_original, $mustache_thumbnail, $post, $wpua_avatar_default, $wpua_disable_gravatar, $wpua_functions;
86
-
87
  $default_image_details = array();
88
 
89
  $size = !empty($args['size'])?$args['size']:96;
90
-
91
  // Show custom Default Avatar
92
  if(!empty($wpua_avatar_default) && $wpua_functions->wpua_attachment_is_image($wpua_avatar_default)) {
93
  // Get image
94
  $wpua_avatar_default_image = $wpua_functions->wpua_get_attachment_image_src($wpua_avatar_default, array($size,$size));
95
  // Image src
96
  $url = $wpua_avatar_default_image[0];
97
- // Add dimensions if numeric size
98
  } else {
99
  // Get mustache image based on numeric size comparison
100
  if($size > get_option('medium_size_w')) {
@@ -113,7 +113,7 @@ class WP_User_Avatar_Functions {
113
 
114
  return $url;
115
  }
116
-
117
  /**
118
  * Returns WP User Avatar or Gravatar-hosted image if user doesn't have Buddypress-uploaded image
119
  * @param string $avatar
@@ -137,7 +137,7 @@ class WP_User_Avatar_Functions {
137
  else
138
  return $gravatar;
139
  }
140
-
141
  /**
142
  * Returns WP user default local avatar URL or Gravatar-hosted image URL if user doesn't have Buddypress-uploaded image
143
  * @param string $avatar
@@ -154,7 +154,7 @@ class WP_User_Avatar_Functions {
154
  else
155
  return $gravatar;
156
  }
157
-
158
  /**
159
  * Returns true if user has Gravatar-hosted image
160
  * @since 1.4
@@ -175,7 +175,7 @@ class WP_User_Avatar_Functions {
175
  //Decide if check gravatar required or not.
176
  if(trim($avatar_default)!='wp_user_avatar')
177
  return true;
178
-
179
  if(!is_object($id_or_email) && !empty($id_or_email)) {
180
  // Find user by ID or e-mail address
181
  $user = is_numeric($id_or_email) ? get_user_by('id', $id_or_email) : get_user_by('email', $id_or_email);
@@ -194,37 +194,38 @@ class WP_User_Avatar_Functions {
194
  {
195
  $hash = md5(strtolower(trim($email)));
196
  //check if gravatar exists for hashtag using options
197
-
198
  if(is_array($wpua_hash_gravatar)){
199
-
200
-
201
  if ( array_key_exists($hash, $wpua_hash_gravatar) and is_array($wpua_hash_gravatar[$hash]) and array_key_exists(date('m-d-Y'), $wpua_hash_gravatar[$hash]) )
202
  {
203
  return (bool) $wpua_hash_gravatar[$hash][date('m-d-Y')];
204
- }
205
-
206
  }
207
-
 
 
208
  //end
209
- if ( isset( $_SERVER['HTTPS'] ) && ( 'on' == $_SERVER['HTTPS'] || 1 == $_SERVER['HTTPS'] ) || isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && 'https' == $_SERVER['HTTP_X_FORWARDED_PROTO'] ) {
210
  $http='https';
211
  }else{
212
  $http='http';
213
  }
214
  $gravatar = $http.'://www.gravatar.com/avatar/'.$hash.'?d=404';
215
-
216
  $data = wp_cache_get($hash);
217
 
218
  if(false === $data) {
219
  $response = wp_remote_head($gravatar);
220
  $data = is_wp_error($response) ? 'not200' : $response['response']['code'];
221
-
222
  wp_cache_set($hash, $data, $group="", $expire=60*5);
223
  //here set if hashtag has avatar
224
  $has_gravatar = ($data == '200') ? true : false;
225
  if($wpua_hash_gravatar == false){
226
- $wpua_hash_gravatar[$hash][date('m-d-Y')] = (bool)$has_gravatar;
227
- add_option('wpua_hash_gravatar',serialize($wpua_hash_gravatar));
 
228
  }
229
  else{
230
 
@@ -250,12 +251,12 @@ class WP_User_Avatar_Functions {
250
  update_option('wpua_hash_gravatar',serialize($wpua_hash_gravatar));
251
 
252
  }*/
253
-
254
  }
255
  //end
256
  }
257
  $has_gravatar = ($data == '200') ? true : false;
258
-
259
  }
260
  else
261
  $has_gravatar = false;
@@ -264,7 +265,7 @@ class WP_User_Avatar_Functions {
264
  return (bool) $has_gravatar;
265
  }
266
 
267
-
268
  /**
269
  * Check if local image
270
  * @since 1.9.2
@@ -365,12 +366,12 @@ class WP_User_Avatar_Functions {
365
  return (bool) $has_wpua;
366
  }
367
  /**
368
- Retrive default image url set by admin.
369
  */
370
  public function wpua_default_image($size)
371
  {
372
  global $avatar_default, $mustache_admin, $mustache_avatar, $mustache_medium, $mustache_original, $mustache_thumbnail, $post, $wpua_avatar_default, $wpua_disable_gravatar, $wpua_functions;
373
-
374
  $default_image_details = array();
375
  // Show custom Default Avatar
376
  if(!empty($wpua_avatar_default) && $wpua_functions->wpua_attachment_is_image($wpua_avatar_default)) {
@@ -380,7 +381,7 @@ class WP_User_Avatar_Functions {
380
  $default = $wpua_avatar_default_image[0];
381
  // Add dimensions if numeric size
382
  $default_image_details['dimensions'] = ' width="'.$wpua_avatar_default_image[1].'" height="'.$wpua_avatar_default_image[2].'"';
383
-
384
  } else {
385
  // Get mustache image based on numeric size comparison
386
  if($size > get_option('medium_size_w')) {
@@ -431,14 +432,14 @@ class WP_User_Avatar_Functions {
431
  * @return string $avatar
432
  */
433
  public function wpua_get_avatar_filter($avatar, $id_or_email="", $size="", $default="", $alt="") {
434
-
435
  global $avatar_default, $mustache_admin, $mustache_avatar, $mustache_medium, $mustache_original, $mustache_thumbnail, $post, $wpua_avatar_default, $wpua_disable_gravatar, $wpua_functions;
436
  // User has WPUA
437
 
438
  if( $alt == '' ) {
439
  $alt = apply_filters('wpua_default_alt_tag',__("Avatar",'wp-user-avatar'));
440
  }
441
-
442
 
443
  $avatar = str_replace('gravatar_default','',$avatar);
444
  if(is_object($id_or_email)) {
@@ -457,7 +458,7 @@ class WP_User_Avatar_Functions {
457
  if(!empty($avatar)) {
458
  $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $avatar, $matches, PREG_SET_ORDER);
459
  $wpua_avatar_image_src = !empty($matches) ? $matches [0] [1] : "";
460
- $default_image_details = $this->wpua_default_image($size);
461
  $wpua_default_avatar_image_src = $default_image_details['src'];
462
  $wpua_final_avatar_image_src = str_replace('d=wp_user_avatar', 'd='.urlencode($wpua_default_avatar_image_src), $wpua_avatar_image_src);
463
  }
@@ -468,11 +469,11 @@ class WP_User_Avatar_Functions {
468
  // User doesn't have WPUA or Gravatar and Default Avatar is wp_user_avatar, show custom Default Avatar
469
  } elseif($avatar_default == 'wp_user_avatar') {
470
 
471
- $default_image_details = $this->wpua_default_image($size);
472
  $avatar = '<img src="'.$default_image_details['src'].'"'.$default_image_details['dimensions'].' alt="'.$alt.'" class="avatar avatar-'.$size.' wp-user-avatar wp-user-avatar-'.$size.' photo avatar-default" />';
473
 
474
  return $avatar;
475
-
476
  }
477
  }
478
  /**
@@ -518,9 +519,9 @@ class WP_User_Avatar_Functions {
518
  // Show custom Default Avatar
519
  if(!empty($wpua_avatar_default) && $wpua_functions->wpua_attachment_is_image($wpua_avatar_default)) {
520
  // $wpua_avatar_default_image = $wpua_functions->wpua_get_attachment_image_src($wpua_avatar_default, array($size,$size));
521
- $size_numeric_w_x_h = array( get_option( $size . '_size_w' ), get_option( $size . '_size_h' ) );
522
- $wpua_avatar_default_image = $wpua_functions->wpua_get_attachment_image_src($wpua_avatar_default, $size_numeric_w_x_h);
523
-
524
  $default = $wpua_avatar_default_image[0];
525
  } else {
526
  $default = $mustache_avatar;
@@ -584,8 +585,8 @@ class WP_User_Avatar_Functions {
584
  public function get_wp_user_avatar($id_or_email="", $size='96', $align="", $alt="") {
585
  global $all_sizes, $avatar_default, $blog_id, $post, $wpdb, $wpua_avatar_default, $wpua_functions, $_wp_additional_image_sizes;
586
  $email='unknown@gravatar.com';
587
- // Checks if comment
588
-
589
  if( $alt == '' ) {
590
  $alt = apply_filters('wpua_default_alt_tag',__("Avatar",'wp-user-avatar'));
591
  }
1
  <?php
2
  /**
3
  * Core user functions.
4
+ *
5
  * @package WP User Avatar
6
  * @version 2.2.4
7
  */
23
  add_filter('bp_core_fetch_avatar', array($this, 'wpua_bp_core_fetch_avatar_filter'), 10, 5);
24
  // Filter to display WP User Avatar by URL at Buddypress
25
  add_filter('bp_core_fetch_avatar_url', array($this, 'wpua_bp_core_fetch_avatar_url_filter'), 10, 5);
26
+
27
  }
28
 
29
 
58
  } else if( $wpua_disable_gravatar ) {
59
 
60
  $url = $this->wpua_get_default_avatar_url($url, $id_or_email, $args);
61
+
62
  } else {
63
 
64
  $has_valid_url = $this->wpua_has_gravatar($id_or_email);
65
  if(!$has_valid_url){
66
  $url = $this->wpua_get_default_avatar_url($url, $id_or_email, $args);
67
  }
68
+
69
  }
70
  /**
71
  * Filter get_avatar_url filter
83
  function wpua_get_default_avatar_url($url, $id_or_email, $args){
84
 
85
  global $avatar_default, $mustache_admin, $mustache_avatar, $mustache_medium, $mustache_original, $mustache_thumbnail, $post, $wpua_avatar_default, $wpua_disable_gravatar, $wpua_functions;
86
+
87
  $default_image_details = array();
88
 
89
  $size = !empty($args['size'])?$args['size']:96;
90
+
91
  // Show custom Default Avatar
92
  if(!empty($wpua_avatar_default) && $wpua_functions->wpua_attachment_is_image($wpua_avatar_default)) {
93
  // Get image
94
  $wpua_avatar_default_image = $wpua_functions->wpua_get_attachment_image_src($wpua_avatar_default, array($size,$size));
95
  // Image src
96
  $url = $wpua_avatar_default_image[0];
97
+ // Add dimensions if numeric size
98
  } else {
99
  // Get mustache image based on numeric size comparison
100
  if($size > get_option('medium_size_w')) {
113
 
114
  return $url;
115
  }
116
+
117
  /**
118
  * Returns WP User Avatar or Gravatar-hosted image if user doesn't have Buddypress-uploaded image
119
  * @param string $avatar
137
  else
138
  return $gravatar;
139
  }
140
+
141
  /**
142
  * Returns WP user default local avatar URL or Gravatar-hosted image URL if user doesn't have Buddypress-uploaded image
143
  * @param string $avatar
154
  else
155
  return $gravatar;
156
  }
157
+
158
  /**
159
  * Returns true if user has Gravatar-hosted image
160
  * @since 1.4
175
  //Decide if check gravatar required or not.
176
  if(trim($avatar_default)!='wp_user_avatar')
177
  return true;
178
+
179
  if(!is_object($id_or_email) && !empty($id_or_email)) {
180
  // Find user by ID or e-mail address
181
  $user = is_numeric($id_or_email) ? get_user_by('id', $id_or_email) : get_user_by('email', $id_or_email);
194
  {
195
  $hash = md5(strtolower(trim($email)));
196
  //check if gravatar exists for hashtag using options
197
+
198
  if(is_array($wpua_hash_gravatar)){
199
+
200
+
201
  if ( array_key_exists($hash, $wpua_hash_gravatar) and is_array($wpua_hash_gravatar[$hash]) and array_key_exists(date('m-d-Y'), $wpua_hash_gravatar[$hash]) )
202
  {
203
  return (bool) $wpua_hash_gravatar[$hash][date('m-d-Y')];
 
 
204
  }
205
+
206
+ }
207
+
208
  //end
209
+ if ( isset( $_SERVER['HTTPS'] ) && ( 'on' == $_SERVER['HTTPS'] || 1 == $_SERVER['HTTPS'] ) || isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && 'https' == $_SERVER['HTTP_X_FORWARDED_PROTO'] ) {
210
  $http='https';
211
  }else{
212
  $http='http';
213
  }
214
  $gravatar = $http.'://www.gravatar.com/avatar/'.$hash.'?d=404';
215
+
216
  $data = wp_cache_get($hash);
217
 
218
  if(false === $data) {
219
  $response = wp_remote_head($gravatar);
220
  $data = is_wp_error($response) ? 'not200' : $response['response']['code'];
221
+
222
  wp_cache_set($hash, $data, $group="", $expire=60*5);
223
  //here set if hashtag has avatar
224
  $has_gravatar = ($data == '200') ? true : false;
225
  if($wpua_hash_gravatar == false){
226
+ $wpua_hash_gravatar = [];
227
+ $wpua_hash_gravatar[$hash][date('m-d-Y')] = (bool)$has_gravatar;
228
+ add_option('wpua_hash_gravatar',serialize($wpua_hash_gravatar));
229
  }
230
  else{
231
 
251
  update_option('wpua_hash_gravatar',serialize($wpua_hash_gravatar));
252
 
253
  }*/
254
+
255
  }
256
  //end
257
  }
258
  $has_gravatar = ($data == '200') ? true : false;
259
+
260
  }
261
  else
262
  $has_gravatar = false;
265
  return (bool) $has_gravatar;
266
  }
267
 
268
+
269
  /**
270
  * Check if local image
271
  * @since 1.9.2
366
  return (bool) $has_wpua;
367
  }
368
  /**
369
+ Retrive default image url set by admin.
370
  */
371
  public function wpua_default_image($size)
372
  {
373
  global $avatar_default, $mustache_admin, $mustache_avatar, $mustache_medium, $mustache_original, $mustache_thumbnail, $post, $wpua_avatar_default, $wpua_disable_gravatar, $wpua_functions;
374
+
375
  $default_image_details = array();
376
  // Show custom Default Avatar
377
  if(!empty($wpua_avatar_default) && $wpua_functions->wpua_attachment_is_image($wpua_avatar_default)) {
381
  $default = $wpua_avatar_default_image[0];
382
  // Add dimensions if numeric size
383
  $default_image_details['dimensions'] = ' width="'.$wpua_avatar_default_image[1].'" height="'.$wpua_avatar_default_image[2].'"';
384
+
385
  } else {
386
  // Get mustache image based on numeric size comparison
387
  if($size > get_option('medium_size_w')) {
432
  * @return string $avatar
433
  */
434
  public function wpua_get_avatar_filter($avatar, $id_or_email="", $size="", $default="", $alt="") {
435
+
436
  global $avatar_default, $mustache_admin, $mustache_avatar, $mustache_medium, $mustache_original, $mustache_thumbnail, $post, $wpua_avatar_default, $wpua_disable_gravatar, $wpua_functions;
437
  // User has WPUA
438
 
439
  if( $alt == '' ) {
440
  $alt = apply_filters('wpua_default_alt_tag',__("Avatar",'wp-user-avatar'));
441
  }
442
+
443
 
444
  $avatar = str_replace('gravatar_default','',$avatar);
445
  if(is_object($id_or_email)) {
458
  if(!empty($avatar)) {
459
  $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $avatar, $matches, PREG_SET_ORDER);
460
  $wpua_avatar_image_src = !empty($matches) ? $matches [0] [1] : "";
461
+ $default_image_details = $this->wpua_default_image($size);
462
  $wpua_default_avatar_image_src = $default_image_details['src'];
463
  $wpua_final_avatar_image_src = str_replace('d=wp_user_avatar', 'd='.urlencode($wpua_default_avatar_image_src), $wpua_avatar_image_src);
464
  }
469
  // User doesn't have WPUA or Gravatar and Default Avatar is wp_user_avatar, show custom Default Avatar
470
  } elseif($avatar_default == 'wp_user_avatar') {
471
 
472
+ $default_image_details = $this->wpua_default_image($size);
473
  $avatar = '<img src="'.$default_image_details['src'].'"'.$default_image_details['dimensions'].' alt="'.$alt.'" class="avatar avatar-'.$size.' wp-user-avatar wp-user-avatar-'.$size.' photo avatar-default" />';
474
 
475
  return $avatar;
476
+
477
  }
478
  }
479
  /**
519
  // Show custom Default Avatar
520
  if(!empty($wpua_avatar_default) && $wpua_functions->wpua_attachment_is_image($wpua_avatar_default)) {
521
  // $wpua_avatar_default_image = $wpua_functions->wpua_get_attachment_image_src($wpua_avatar_default, array($size,$size));
522
+ $size_numeric_w_x_h = array( get_option( $size . '_size_w' ), get_option( $size . '_size_h' ) );
523
+ $wpua_avatar_default_image = $wpua_functions->wpua_get_attachment_image_src($wpua_avatar_default, $size_numeric_w_x_h);
524
+
525
  $default = $wpua_avatar_default_image[0];
526
  } else {
527
  $default = $mustache_avatar;
585
  public function get_wp_user_avatar($id_or_email="", $size='96', $align="", $alt="") {
586
  global $all_sizes, $avatar_default, $blog_id, $post, $wpdb, $wpua_avatar_default, $wpua_functions, $_wp_additional_image_sizes;
587
  $email='unknown@gravatar.com';
588
+ // Checks if comment
589
+
590
  if( $alt == '' ) {
591
  $alt = apply_filters('wpua_default_alt_tag',__("Avatar",'wp-user-avatar'));
592
  }
includes/class-wp-user-avatar.php CHANGED
@@ -40,7 +40,7 @@ class WP_User_Avatar {
40
 
41
  return ob_get_clean();
42
 
43
- }, 10, 2);
44
 
45
  // Admin scripts
46
  $pages = array('profile.php', 'options-discussion.php', 'user-edit.php', 'user-new.php');
40
 
41
  return ob_get_clean();
42
 
43
+ }, 9999999999999999999, 2);
44
 
45
  // Admin scripts
46
  $pages = array('profile.php', 'options-discussion.php', 'user-edit.php', 'user-new.php');
readme.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: properfraction, collizo4sky
4
  Tags: user profile, avatar, gravatar, author image, author photo, author avatar, bbPress, profile avatar, profile image, user avatar, user image, user photo, widget
5
  Requires at least: 4.0
6
  Tested up to: 5.6
7
- Stable tag: 2.2.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -370,6 +370,12 @@ This would output:
370
 
371
  == Changelog ==
372
 
 
 
 
 
 
 
373
  = 2.2.8 =
374
  * Fixed: Notice: Object of class WP_User could not be converted.
375
  * Replace core Profile Picture in profile edit screen with WP User Avatar.
4
  Tags: user profile, avatar, gravatar, author image, author photo, author avatar, bbPress, profile avatar, profile image, user avatar, user image, user photo, widget
5
  Requires at least: 4.0
6
  Tested up to: 5.6
7
+ Stable tag: 2.2.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
370
 
371
  == Changelog ==
372
 
373
+ = 2.2.9 =
374
+ * Fixed PHP Notice: Trying to get property 'ID' of non-object.
375
+ * Fixed Fatal Error: Cannot use string offset as an array.
376
+ * Fixed: Deprecated: whitelist_options is deprecated since version 5.5.0
377
+ * Increased the priority of user_profile_picture_description filter usage
378
+
379
  = 2.2.8 =
380
  * Fixed: Notice: Object of class WP_User could not be converted.
381
  * Replace core Profile Picture in profile edit screen with WP User Avatar.
wp-user-avatar.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://wordpress.org/plugins/wp-user-avatar/
5
  Description: Use any image from your WordPress Media Library as a custom user avatar. Add your own Default Avatar.
6
  Author: ProfilePress
7
  Author URI: https://profilepress.net/
8
- Version: 2.2.8
9
  Text Domain: wp-user-avatar
10
  Domain Path: /lang/
11
  */
@@ -33,7 +33,7 @@ class WP_User_Avatar_Setup {
33
  * @since 1.9.2
34
  */
35
  private function _define_constants() {
36
- define('WPUA_VERSION', '2.2.8');
37
  define('WPUA_FOLDER', basename(dirname(__FILE__)));
38
  define('WPUA_DIR', plugin_dir_path(__FILE__));
39
  define('WPUA_INC', WPUA_DIR.'includes'.'/');
5
  Description: Use any image from your WordPress Media Library as a custom user avatar. Add your own Default Avatar.
6
  Author: ProfilePress
7
  Author URI: https://profilepress.net/
8
+ Version: 2.2.9
9
  Text Domain: wp-user-avatar
10
  Domain Path: /lang/
11
  */
33
  * @since 1.9.2
34
  */
35
  private function _define_constants() {
36
+ define('WPUA_VERSION', '2.2.9');
37
  define('WPUA_FOLDER', basename(dirname(__FILE__)));
38
  define('WPUA_DIR', plugin_dir_path(__FILE__));
39
  define('WPUA_INC', WPUA_DIR.'includes'.'/');