I have a custom user bar that displays the name and picture of the current signed in user, it pulls the information from the member database. Everything works fine until I assign the user the admin role then it pulls the wrong picture and name. If I delete the admin role for that member everything goes back to working.
It's a very simple setup, a text element that connects to the name field and a image element that connects to the picture field in the member database. Then this code is used:
import wixUsers from 'wix-users';
$w.onReady( () => {
if(wixUsers.currentUser.loggedIn) {
$w("#userName").show();
$w("#userPicture").show();
}
else {
$w("#userName").hide();
$w("#userPicture").hide();
}
} );
What am I missing that makes this not work for admin users/members?
Thanks!
Have a read of the users api here:
https://www.wix.com/corvid/reference/wix-users.User.html
You can try adding code so that you can pull the member roles too.
https://www.wix.com/corvid/reference/wix-users.User.html#getRoles
https://www.wix.com/corvid/reference/wix-users.User.html#UserRole