Issue pulling user database info after being assigned admin role

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

I guess what I don’t understand is why would you need to pull the member roles at all. As far as the above code is concerned, what changes when a user is given admin rights to make the code I already have not work? All i’m asking it to do is check the logged in user and pull their name and picture from the database but when someone has admin permissions it doesn’t work.