Feb 23, 2023 7:24 pm
Hello, I have a problem with the avatars in the forum, does anyone have an idea how I can fix it?
I’m attaching a photo, I’m using the Classiads theme
The problem is also noticeable in Widget - Recent Post & Recent Topics and in the Blog and the Archive it is the same
This is the theme code that I have shown in the picture.
if($preset_header_style == 12){ if(!empty($avatar_id) && is_numeric($avatar_id)) { $image_src_array = $author_avatar_url[0]; $params = array( 'width' => 37, 'height' => 37, 'crop' => true ); $user_thumb = '<img src="' . bfi_thumb( $image_src_array, $params ) . '" alt="'.$logedin_user_name.'" />'; } else{ $avatar_url = get_avatar_url($logedin_user, ['size' => '37']); $user_thumb ='<img src="'.$avatar_url.'" alt="'.$logedin_user_name.'" />'; } }else{ if(!empty($avatar_id) && is_numeric($avatar_id)) { $image_src_array = $author_avatar_url[0]; $params = array( 'width' => 40, 'height' => 40, 'crop' => true ); $user_thumb = '<img src="' . bfi_thumb( $image_src_array, $params ) . '" alt="'.$logedin_user_name.'" />'; //pacz_add_image_size( '70-70', 70, 70, true ); //$user_thumb = '<img src="' . wp_get_attachment_image_url( $avatar_id, '70-70' ) . '" alt="'.$logedin_user_name.'" />'; } else{ $avatar_url = get_avatar_url($logedin_user, ['size' => '40']); $user_thumb ='<img src="'.$avatar_url.'" alt="'.$logedin_user_name.'" />'; } }
6 Replies
Feb 24, 2023 7:43 am
This is the code from the comments that works and pulls the correct avatars
I tried to put it in wpforo/theme/2022/profile.php but it still takes out the gravatar :/
<div class="pacz-post-comment-author-img"> <?php $avatar_id = get_user_meta( $comment->user_id, 'avatar_id', true ); if(!empty($avatar_id) && is_numeric($avatar_id)) { $author_avatar_url = wp_get_attachment_image_src( $avatar_id, 'full' ); $image_src_array = $author_avatar_url[0]; $params = array( 'width' => 70, 'height' => 70, 'crop' => true ); echo '<img src="' . bfi_thumb( $image_src_array, $params ).'" alt="'. esc_attr__('author', 'classiadspro') .'" />'; } else { $avatar_url = get_avatar_url($comment->user_id, ['size' => '70']); echo'<img src="'.$avatar_url.'" alt="'. esc_attr__('author', 'classiadspro') .'" />'; } ?> </div>
And this is how the avatar appears in the forum and in the blog comments
Feb 25, 2023 10:07 am
you can also deactivate Gravatar if you do not want them to be displayed
How to Disable Gravatars in WordPress