22
33/**
44 ** get_avatar.php
5- ** @version 1.3
5+ ** @version 1.3.1
66 ** @since 1.0
77 ** @author en0ndev
88 */
@@ -82,13 +82,13 @@ function cpa__get__avatar__new($getType)
8282function cpa__get__value ($ getType )
8383{
8484 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 " )
8686 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 ' );
8989 return $ get__default__avatar ;
9090 } else
91- return 0 ;
91+ return "" ;
9292}
9393
9494function compare__comment__id ($ a , $ b )
@@ -204,12 +204,14 @@ function get_avatar($id_or_email, $size = 96, $default = '', $alt = '', $args =
204204 $ get__comments = get_comments ();
205205 }
206206
207+
207208 $ get__parent__id__arr = array ();
208209 foreach ($ get__comments as $ get__comment ) {
209210 array_push ($ get__parent__id__arr , $ get__comment ->comment_parent );
210211 }
211212 $ get__parent__id__arr__cln = $ get__parent__id__arr ;
212213
214+
213215 $ indx__getting__comments = 0 ;
214216 foreach ($ get__comments as $ get__comment ) {
215217
@@ -242,8 +244,10 @@ function get_avatar($id_or_email, $size = 96, $default = '', $alt = '', $args =
242244
243245 if ($ get__parent__id__arr__cln__cnt > 1 ) {
244246
247+
245248 $ gttng__pos = $ get__parent__id__arr__cln__cnt - $ get__parent__id__arr__cnt + 1 ;
246249
250+
247251 $ 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 ));
248252
249253 $ 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 =
262266 }
263267 }
264268
269+
265270 $ indx__getting__comments ++;
266271 }
267272
@@ -282,6 +287,7 @@ function get_avatar($id_or_email, $size = 96, $default = '', $alt = '', $args =
282287 $ spcfc__admn__pg = 1 ;
283288 }
284289
290+
285291 $ cpa__WPScreen = WP_Screen::get ();
286292
287293 $ option = $ cpa__WPScreen ->get_option ('per_page ' , 'option ' );
@@ -298,6 +304,7 @@ function get_avatar($id_or_email, $size = 96, $default = '', $alt = '', $args =
298304 $ comment_status = isset ($ _REQUEST ['comment_status ' ]) ? $ _REQUEST ['comment_status ' ] : 'all ' ;
299305 $ per_page = apply_filters ('comments_per_page ' , $ per_page , $ comment_status );
300306
307+
301308 if (is_admin () && isset ($ _GET ["paged " ]) && ($ _GET ["paged " ] > 1 ) && get_current_screen ()->id === "edit-comments " && ($ _GET ["paged " ] - 1 ) * $ per_page > $ get__commenter__indx ) {
302309 $ chng__pos = $ _GET ["paged " ];
303310 $ get__commenter__indx = 0 ;
@@ -307,10 +314,13 @@ function get_avatar($id_or_email, $size = 96, $default = '', $alt = '', $args =
307314 }
308315 }
309316
317+
310318 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 " ))) {
311319 $ custom__avatar = get_user_meta ($ usr__id , 'custom_profile_avatar ' )[0 ];
320+ //echo 1 . " " . $get__commenter__indx;
312321 } 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 " ))) {
313322 $ custom__avatar = get_user_meta ($ id_or_email , 'custom_profile_avatar ' )[0 ];
323+ //echo 2 . " " . $get__commenter__indx;
314324 } else if (!get_comment_ID ()) {
315325 if (get_option ("custom_profile_avatar__options__disable__gravatar " ) == "on " ) {
316326 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 =
327337 }
328338 } 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 )) {
329339
340+
330341 if (get_comment_ID () > 0 && $ get__commenter__indx < 0 ) {
331342 $ get__commenter__indx ++;
332343 }
333344
345+
334346 $ custom__avatar = get_user_meta ($ comments__author__id__array [$ get__commenter__indx ], 'custom_profile_avatar ' )[0 ];
335347
348+
336349 if (is_single () || is_page () || is_singular () || get_current_screen ()->id === "dashboard " ) {
337350 if (get_comment_ID () > 0 ) {
338351 $ get__commenter__indx ++;
0 commit comments