Title: get_avatar WordPress function and NextEnd
Last modified: January 18, 2021

---

# get_avatar WordPress function and NextEnd

 *  Resolved [SuperStu](https://wordpress.org/support/users/omgstu/)
 * (@omgstu)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/get_avatar-wordpress-function-and-nextend/)
 * Hi again, another question 🙂
 * I am testing the plugin with Google and it works well, however when creating 
   a user it pulls in the avatar from Google which is great but when I try and use
   the WordPress get_avatar function this grabs the Gravatar image?
 * Not sure how to get the new image which is what I would expect and this also 
   appears to be stored in a custom folder /nsl_avatars/
 * I have a custom profile page (not using standard WordPress user page) that when
   a user is created it copies the profile image to a custom field.
 * is there a way to do this?
    -  This topic was modified 5 years, 4 months ago by [SuperStu](https://wordpress.org/support/users/omgstu/).

Viewing 13 replies - 1 through 13 (of 13 total)

 *  Plugin Support [Laszlo](https://wordpress.org/support/users/laszloszalvak/)
 * (@laszloszalvak)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/get_avatar-wordpress-function-and-nextend/#post-13926159)
 * Hi [@omgstu](https://wordpress.org/support/users/omgstu/)
 * I just checked it on my local test site and the get_avatar() function, e.g.:
   `
   <?php echo get_avatar(get_current_user_id()); ?>` worked fine for me, as it displayed
   the currently logged in users’s avatar that we stored with social login.
 * If it didn’t work for you for some reason. Could you check please if the user
   that you checked the get_avatar() function with, indeed have an avatar stored
   by Nextend Social Login. E.g. in the users table ( /wp-admin/users.php ) we display
   the avatars by default. Can you see the social avatar appearing there?
    Also 
   does the get_avatar() function displays the social avatar, when you disable all
   plugins except Nextend Social Login and you change your theme to a WordPress 
   default one like Twenty Twenty?
 *  Thread Starter [SuperStu](https://wordpress.org/support/users/omgstu/)
 * (@omgstu)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/get_avatar-wordpress-function-and-nextend/#post-13930550)
 * I am using get_avatar_url (not get_avatar) and this seems to return the gravatar,
   rather than the local stored image url location…
 * not sure if its related to this (different plugin but same issue)
 * [https://github.com/10up/simple-local-avatars/pull/40](https://github.com/10up/simple-local-avatars/pull/40)
 * cheers
 *  Plugin Support [Laszlo](https://wordpress.org/support/users/laszloszalvak/)
 * (@laszloszalvak)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/get_avatar-wordpress-function-and-nextend/#post-13936752)
 * Hi [@omgstu](https://wordpress.org/support/users/omgstu/)
 * I am sorry, but currently the social avatars can only be retrieved over the get_avatar()
   function:
    - [https://developer.wordpress.org/reference/functions/get_avatar/](https://developer.wordpress.org/reference/functions/get_avatar/)
 * but not the get_avatar_url() function:
    - [https://developer.wordpress.org/reference/functions/get_avatar_url/](https://developer.wordpress.org/reference/functions/get_avatar_url/)
 * However it is on our To Do list, so we may make it in a future release. I will
   inform you here.
 * Best regards,
    Laszlo.
 *  Thread Starter [SuperStu](https://wordpress.org/support/users/omgstu/)
 * (@omgstu)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/get_avatar-wordpress-function-and-nextend/#post-13951363)
 * Cool thanks, this work out OK apart from. One thing.
 * I’ve created a shortcode to output the image, however I don’t seem to be able
   to set the size. It’s always 96 x 96 PX no matter the size I specify in the get_avitar
   size argument.
 * If I look in the library the images are pulled in at that size. Is there a way
   to get them at their Max size?
 *  Plugin Support [Laszlo](https://wordpress.org/support/users/laszloszalvak/)
 * (@laszloszalvak)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/get_avatar-wordpress-function-and-nextend/#post-13954104)
 * Hi [@omgstu](https://wordpress.org/support/users/omgstu/)
 * Nextend Social Login stores the avatars only in one size, and you can find them
   in the wp-content/uploads/nsl_avatars folder.
    This one size depends on the size
   of the image that the provider returns.
 * So when you display the image with the get_avatar() function, it won’t create
   additional sub-sizes of the image, but it will simply get the image with the 
   size that is available and that image will be displayed in an img element with
   the specified size.
 * So this is already the max size, I am sorry.
 *  Thread Starter [SuperStu](https://wordpress.org/support/users/omgstu/)
 * (@omgstu)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/get_avatar-wordpress-function-and-nextend/#post-13956528)
 * thats a shame looks like the Google people API doe let the option for specifying
   other sizes, but never mind ill just have to work with 96px
 * When using the get_avatar() function, you can go down in size, but unfortunately
   not up in size for the image.
 * Cheers.
    -  This reply was modified 5 years, 4 months ago by [SuperStu](https://wordpress.org/support/users/omgstu/).
 *  Plugin Support [Laszlo](https://wordpress.org/support/users/laszloszalvak/)
 * (@laszloszalvak)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/get_avatar-wordpress-function-and-nextend/#post-13965435)
 * Hi [@omgstu](https://wordpress.org/support/users/omgstu/)
 * We use the OAuth2 REST API endpoint to get the basic profile information like
   name, email, avatar.
 * **But returning to the problem with the scaling of the image:**
    In the current
   release we have a function hooked to the get_avatar filter, and in that function
   we are rendering the avatar, but it can not scale larger then that original size.
   But starting from our next release ( version 3.0.27 ) we will rather use the “
   pre_get_avatar_data” filter:
    - [https://developer.wordpress.org/reference/hooks/pre_get_avatar_data/](https://developer.wordpress.org/reference/hooks/pre_get_avatar_data/)
 * which means:
    - you will be able to get the social avatars with the get_avatar_url() function
    - we will no longer need to modify the avatars over the get_avatar filter, so
      the get_avatar() function will be able to render the image the same way as
      WordPress does. ( So the images will be able to be scaled up )
 * We will try to release a new version soon, hopefully before the end of this week.
 * Best regards,
    Laszlo.
 *  Thread Starter [SuperStu](https://wordpress.org/support/users/omgstu/)
 * (@omgstu)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/get_avatar-wordpress-function-and-nextend/#post-13967130)
 * You guys are doing great work, appreciate the updates.
 * Thanks again.
 *  Plugin Support [Laszlo](https://wordpress.org/support/users/laszloszalvak/)
 * (@laszloszalvak)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/get_avatar-wordpress-function-and-nextend/#post-13968633)
 * Hi [@omgstu](https://wordpress.org/support/users/omgstu/)
 * I just wanted to let you know we have just released the version 3.0.27 which 
   contains the modifications I described above.
    Feel free to give it a try.
 *  Thread Starter [SuperStu](https://wordpress.org/support/users/omgstu/)
 * (@omgstu)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/get_avatar-wordpress-function-and-nextend/#post-13981277)
 * Cool, so I can now use the get_avatar and the image scales up well.
 * However, I am still getting the same gravatar url returned when I use get_avatar_url
   and not the URL to the wp-content/uploads/nsl_avatars directory path – not that’s
   its an issue really with the previous step 🙂
 * maybe I a missing something… anyway the first works.
 * this is my function
 * add_action(‘nsl_register_new_user’, ‘nsl_register_activated’, 10, 2);
    function
   nsl_register_activated($user_id) { $user = new WP_User($user_id); // add_user_meta(
   $user->ID, ‘wpcf-activated’, $user_id);
 * { // Edit form ID
    //update to a MEMBER role type on Authentication and create
   PROFILE wp_update_user( array( ‘ID’ => $user_id, ‘role’ => ‘member’ ) ); $user_info
   = get_userdata($user_id); $user_first = ucfirst($user_info->first_name); $user_last
   = ucfirst($user_info->last_name); $avatar = get_avatar_url( $user_id ); $combined
   = $user_id.”-“.$user_first.”-“.$user_last;
 *  $my_post = array(
    ‘post_title’ => $user_first.” “.$user_last, ‘post_status’
   => ‘publish’, ‘post_author’ => $user_id, ‘post_name’ => $combined, ‘post_type’
   => ‘profile’, // meta_input is array of meta fields when inserting into. ‘meta_input’
   => array( ‘wpcf-member-profile-display-name’ => $user_first.” “.$user_last, //
   adds profile URL to custom field. ‘wpcf-member-profile-picture’ => $avatar, ),);
 *  // Insert the post into the database
    wp_insert_post( $my_post ); }
 * };
 *  Plugin Support [Laszlo](https://wordpress.org/support/users/laszloszalvak/)
 * (@laszloszalvak)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/get_avatar-wordpress-function-and-nextend/#post-13987220)
 * Hi [@omgstu](https://wordpress.org/support/users/omgstu/)
 * Please note that, we can not provide support for custom coding. But I checked
   your codes and the problem is that, at the point where you are trying to get 
   the avatar with get_avatar_url() function, we haven’t stored the avatar yet, 
   as the avatars will be synchronized on login.
 * The second parameter of the “nsl_register_new_user” action is the instance of
   the provider that the user is trying to connect over. Using that you could run
   the functions of the provider, e.g. you could synchronizing the profile. That
   way you could get the avatars stored on registration, too.
    Here you can find
   an example code for triggering the avatar synchronization on the action that 
   you used:
 *     ```
       add_action('nsl_register_new_user', 'nsl_register_activated', 10, 2);
       function nsl_register_activated($user_id, $provider) {
           $provider->syncProfile($user_id, $provider, $provider->getAccessToken($user_id));
       };
       ```
   
 * So in your function, this syncProfile() method should be called before you use
   the get_avatar_url() and that will fix the problem!
 * Best regards,
    Laszlo.
 *  Thread Starter [SuperStu](https://wordpress.org/support/users/omgstu/)
 * (@omgstu)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/get_avatar-wordpress-function-and-nextend/#post-13989057)
 * you guys are awesome – appreciate you guiding me through this … looking forward
   to testing in a minute.
 *  Thread Starter [SuperStu](https://wordpress.org/support/users/omgstu/)
 * (@omgstu)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/get_avatar-wordpress-function-and-nextend/#post-13994252)
 * Works perfectly by the way. 🙂 appreciate the help

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘get_avatar WordPress function and NextEnd’ is closed to new replies.

 * ![](https://ps.w.org/nextend-facebook-connect/assets/icon.svg?rev=3336394)
 * [Nextend Social Login and Register](https://wordpress.org/plugins/nextend-facebook-connect/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/nextend-facebook-connect/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/nextend-facebook-connect/)
 * [Active Topics](https://wordpress.org/support/plugin/nextend-facebook-connect/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nextend-facebook-connect/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nextend-facebook-connect/reviews/)

 * 13 replies
 * 2 participants
 * Last reply from: [SuperStu](https://wordpress.org/support/users/omgstu/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/get_avatar-wordpress-function-and-nextend/#post-13994252)
 * Status: resolved