nicumicle/simple-jwt-login

add option to get user avatar url in auth payload (get_avatar_url)

elmcapp opened this issue · 3 comments

It would be nice if we could get the user photo or avatar url when we use the auth endpoint

You can achieve this by using hooks.

For example simple_jwt_login_response_auth_user can modify the response of auth endpoint.

Here is an example:

add_filter('simple_jwt_login_response_auth_user',function($response, $user){
    $response['avatar'] = ...
    return $response;
},10, 2);

Would I put this in the function.php in my theme or is there somewhere else I can put this where it does not get updated when my Wordpress site updates

I would create a child theme with only the functions.php file. This file would include the original functions.php file from the theme plus your hooks.

This way you will be sure that you will not lose the hooks when you update your theme.