2
2
3
3
/**
4
4
** get_avatar.php
5
- ** @version 1.3
5
+ ** @version 1.3.1
6
6
** @since 1.0
7
7
** @author en0ndev
8
8
*/
@@ -82,13 +82,13 @@ function cpa__get__avatar__new($getType)
82
82
function cpa__get__value ($ getType )
83
83
{
84
84
global $ current_user ;
85
- if (get_user_meta ($ current_user ->id , 'custom_profile_avatar ' )[0 ] && $ getType == "custom__avatar " )
85
+ if (isset ( get_user_meta ( $ current_user -> id , ' custom_profile_avatar ' )[ 0 ]) && get_user_meta ($ current_user ->id , 'custom_profile_avatar ' )[0 ] && $ getType == "custom__avatar " )
86
86
return get_user_meta ($ current_user ->id , 'custom_profile_avatar ' )[0 ];
87
- elseif ($ getType == "default__avatar " ) {
88
- $ get__default__avatar = get_option ('custom_profile_avatar__options__default__avatar ' ) !== false ? get_option ( ' custom_profile_avatar__options__default__avatar ' ) : plugins_url () . " /custom-profile-avatar/assets/img/default-non-user-avatar.jpg " ;
87
+ elseif (! empty ( get_option ( ' custom_profile_avatar__options__default__avatar ' )) && $ getType == "default__avatar " ) {
88
+ $ get__default__avatar = get_option ('custom_profile_avatar__options__default__avatar ' );
89
89
return $ get__default__avatar ;
90
90
} else
91
- return 0 ;
91
+ return "" ;
92
92
}
93
93
94
94
function compare__comment__id ($ a , $ b )
@@ -204,12 +204,14 @@ function get_avatar($id_or_email, $size = 96, $default = '', $alt = '', $args =
204
204
$ get__comments = get_comments ();
205
205
}
206
206
207
+
207
208
$ get__parent__id__arr = array ();
208
209
foreach ($ get__comments as $ get__comment ) {
209
210
array_push ($ get__parent__id__arr , $ get__comment ->comment_parent );
210
211
}
211
212
$ get__parent__id__arr__cln = $ get__parent__id__arr ;
212
213
214
+
213
215
$ indx__getting__comments = 0 ;
214
216
foreach ($ get__comments as $ get__comment ) {
215
217
@@ -242,8 +244,10 @@ function get_avatar($id_or_email, $size = 96, $default = '', $alt = '', $args =
242
244
243
245
if ($ get__parent__id__arr__cln__cnt > 1 ) {
244
246
247
+
245
248
$ gttng__pos = $ get__parent__id__arr__cln__cnt - $ get__parent__id__arr__cnt + 1 ;
246
249
250
+
247
251
$ comments__author__id__array = array_merge (array_slice ($ comments__author__id__array , 0 , $ pos__for__arr + $ gttng__pos ), array ($ comment__author__id ), array_slice ($ comments__author__id__array , $ pos__for__arr + $ gttng__pos ));
248
252
249
253
$ comments__id__array = array_merge (array_slice ($ comments__id__array , 0 , $ pos__for__arr + $ gttng__pos ), array ($ comment__id ), array_slice ($ comments__id__array , $ pos__for__arr + $ gttng__pos ));
@@ -262,6 +266,7 @@ function get_avatar($id_or_email, $size = 96, $default = '', $alt = '', $args =
262
266
}
263
267
}
264
268
269
+
265
270
$ indx__getting__comments ++;
266
271
}
267
272
@@ -282,6 +287,7 @@ function get_avatar($id_or_email, $size = 96, $default = '', $alt = '', $args =
282
287
$ spcfc__admn__pg = 1 ;
283
288
}
284
289
290
+
285
291
$ cpa__WPScreen = WP_Screen::get ();
286
292
287
293
$ option = $ cpa__WPScreen ->get_option ('per_page ' , 'option ' );
@@ -298,6 +304,7 @@ function get_avatar($id_or_email, $size = 96, $default = '', $alt = '', $args =
298
304
$ comment_status = isset ($ _REQUEST ['comment_status ' ]) ? $ _REQUEST ['comment_status ' ] : 'all ' ;
299
305
$ per_page = apply_filters ('comments_per_page ' , $ per_page , $ comment_status );
300
306
307
+
301
308
if (is_admin () && isset ($ _GET ["paged " ]) && ($ _GET ["paged " ] > 1 ) && get_current_screen ()->id === "edit-comments " && ($ _GET ["paged " ] - 1 ) * $ per_page > $ get__commenter__indx ) {
302
309
$ chng__pos = $ _GET ["paged " ];
303
310
$ get__commenter__indx = 0 ;
@@ -307,10 +314,13 @@ function get_avatar($id_or_email, $size = 96, $default = '', $alt = '', $args =
307
314
}
308
315
}
309
316
317
+
310
318
if (isset (get_user_meta ($ usr__id , 'custom_profile_avatar ' )[0 ]) && (get_user_meta ($ usr__id , 'custom_profile_avatar ' )[0 ]) && (isset ($ roles [0 ]) && ((get_option ("custom_profile_avatar__options__permissions " )[$ roles [0 ]] ?? 0 ) == "on " || $ roles [0 ] == "administrator " ))) {
311
319
$ custom__avatar = get_user_meta ($ usr__id , 'custom_profile_avatar ' )[0 ];
320
+ //echo 1 . " " . $get__commenter__indx;
312
321
} else if (isset (get_user_meta ($ id_or_email , 'custom_profile_avatar ' )[0 ]) && (get_user_meta ($ id_or_email , 'custom_profile_avatar ' )[0 ]) && (isset ($ roles [0 ]) && ((get_option ("custom_profile_avatar__options__permissions " )[$ roles [0 ]] ?? 0 ) == "on " || $ roles [0 ] == "administrator " ))) {
313
322
$ custom__avatar = get_user_meta ($ id_or_email , 'custom_profile_avatar ' )[0 ];
323
+ //echo 2 . " " . $get__commenter__indx;
314
324
} else if (!get_comment_ID ()) {
315
325
if (get_option ("custom_profile_avatar__options__disable__gravatar " ) == "on " ) {
316
326
if (strlen (get_option ("custom_profile_avatar__options__default__avatar " )) > 0 ) {
@@ -327,12 +337,15 @@ function get_avatar($id_or_email, $size = 96, $default = '', $alt = '', $args =
327
337
}
328
338
} else if (isset (get_user_meta ($ comments__author__id__array [$ get__commenter__indx ], 'custom_profile_avatar ' )[0 ]) && (get_user_meta ($ comments__author__id__array [$ get__commenter__indx ], 'custom_profile_avatar ' )[0 ]) && (isset ($ commenter__role [0 ]) && ((get_option ("custom_profile_avatar__options__permissions " )[$ commenter__role [0 ]] ?? 0 ) == "on " || $ commenter__role [0 ] == "administrator " )) && (is_single () || is_page () || is_singular () || $ spcfc__admn__pg == 1 )) {
329
339
340
+
330
341
if (get_comment_ID () > 0 && $ get__commenter__indx < 0 ) {
331
342
$ get__commenter__indx ++;
332
343
}
333
344
345
+
334
346
$ custom__avatar = get_user_meta ($ comments__author__id__array [$ get__commenter__indx ], 'custom_profile_avatar ' )[0 ];
335
347
348
+
336
349
if (is_single () || is_page () || is_singular () || get_current_screen ()->id === "dashboard " ) {
337
350
if (get_comment_ID () > 0 ) {
338
351
$ get__commenter__indx ++;
0 commit comments