Display post author avatar for Ultimate Member
To get user’s avatars of the UM plugin, you have to do this : // Returns a given user’s avatar um_get_user_avatar_url( $user_id = ”, $size=”96″ )
To get user’s avatars of the UM plugin, you have to do this : // Returns a given user’s avatar um_get_user_avatar_url( $user_id = ”, $size=”96″ )
The get_avatar filter hook doesn’t apply only to the user with the ID 1 – I’m assuming you have this idea because of the example from page about the get_avatar at the codex –, but in reality it targets the user according to the context it is used in, so every possible user, not solely … Read more
Paste below code in function.php file function theme_custom_avatar_url($url, $idOrEmail, $args){ return get_home_url() . ‘/wp-content/uploads/…/profile_image_0.jpg’; } add_filter(‘get_avatar_url’, ‘theme_custom_avatar_url’, 10, 3);
WordPress User profile with Avatar upload on the front end without plugin?
I managed to come up with the answer 😀 Thanks to @Jos function ht1_change_avatar($args, $id_or_email) { $gender = get_user_meta($id_or_email, ‘user_gender’, true); if($gender==’Male’){ $myavatar=”http://localhost:81/matrimony/wp-content/uploads/2020/04/groom.png”; }else{ $myavatar=”http://localhost:81/matrimony/wp-content/uploads/2020/04/bride.png”; } $args[‘url’] = $myavatar; return $args; } add_filter(‘get_avatar_data’, ‘ht1_change_avatar’, 100, 2);
Try this <?php if ($args[‘avatar_size’] != 0) echo get_avatar($comment,’70’,$default, $alt,array(‘class’=>array(‘media-object’,’thumbnail’))); ?>
I found a solution and now my frontend avatar script is fully functioning. Happy days 🙂 I ended up scrapping the above code and using this. add_filter( ‘pre_get_avatar_data’, ‘wad_avatar_meta’, 10, 2 ); function wad_avatar_meta( $args, $id_or_email ){ $user_avatar_meta_key = ‘avatar’; if( is_object( $id_or_email ) && isset( $id_or_email->comment_ID ) ){ $id_or_email = get_comment( $id_or_email ); } … Read more
WordPress doesn’t have built-in profile pictures (Avatars) by default. See Settings > Discussion in the menu for available options. So you may have a few options: Use Gravatar, as this is bundled in WordPress by default and free but would not require a profile image upload button as its managed separately. Look for an Avatar … Read more
I would loop through an array with the authors and then get their avatar and save them in a different array. You can use get_users() to get the users and you already know how to get their avatar. You can get users using get_users() by giving it an array with arguments to specify what you … Read more
WordPress has wp_get_current_user() function for getting the current (logged in) user, which you could use. If the returned WP_User object doesn’t have all the details you need, you can get either all or a specific user meta with get_user_meta(). For getting the user’s avatar, you could use get_avatar(). Have a look at the function docs … Read more