Last active
October 23, 2024 02:19
-
-
Save champsupertramp/45cc47f4d5fe67cf739b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*** | |
*** @Get user avatar uri | |
***/ | |
// Call ultimatemember global variable | |
global $ultimatemember; | |
$user_id = 1; | |
// Set user ID | |
$ultimatemember->user->set( $user_id ); | |
// Returns current user avatar | |
$avatar_uri = um_get_avatar_uri( um_profile('profile_photo'), 32 ); | |
// Returns default UM avatar, e.g. https://ultimatemember.com/wp-content/uploads/2015/01/default_avatar.jpg | |
$default_avatar_uri = um_get_default_avatar_uri(); | |
?> |
Hi Champ,
I am having an error saying "Uncaught Error: Call to a member function set() on null in..."
Hi @edwenjohn
If you're using version 2.0+, please use the following code snippet:
<?php
/***
*** @Get user avatar uri
***/
$user_id = 1;
// Set user ID
um_fetch_user( $user_id );
// Returns current user avatar
$avatar_uri = um_get_avatar_uri( um_profile('profile_photo'), 32 );
// Returns default UM avatar, e.g. https://ultimatemember.com/wp-content/uploads/2015/01/default_avatar.jpg
$default_avatar_uri = um_get_default_avatar_uri();
?>
Regards,
This is working great. Thank you.
However, if a user signs up using Social Log In this doesn't show their profile photo. Even though their social media profile is showing as their profile photo in UM account. I'm not sure how to fix that.
Thank you again.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Champ. I would like to show the user avatar left from the user firstname with shortcode. I already use the shortcode
[um_user user_id="" meta_key="first_name"]
from your #https://gist.github.com/champsupertramp/a1ed201cb05ff68bcecac4c7cd5b004b