[SOLVED] I'm the owner/admin of the website but why is my role member?

I want to show/hide a custom menu based on different roles but my admin account is identified as a member. Here’s how I checked the role via code:

let userRole = wixUsers.currentUser.role
console.log(userRole)

In the console logs it shows up as Member. I made sure that I logged in my Owner/Admin account.

Am I missing something? I spent the entire day figuring this out, I’ve read other threads as well. I’m stumped and I’m really desperate.

Anyone?

@chocookie22
Can you console-log it for me and show the console-log (using google-chrome)? I do not have the possibility right now to do it myself.
console . log ( userRole )
Waiting for Screenshot.
Also open all given 3-dots(objects) inside the log.

As i can remember the role includes an array with 2 different roles–> [0],[1]

@russian-dima Thank you so much for responding, here’s the screenshot.

Just to clarify, I assign the roles via Dashboard>CRM Tools>Site Members right?

@chocookie22
Ok, i checked the problem for you and i could figure out that everything works like it should.

After login as ADMIN, i get this console-log in my Browser…


Here the code for you to do the same…

import wixUsers from 'wix-users';

$w.onReady(function() {
  let currentUser = wixUsers.currentUser; console.log("Current-User: ", currentUser);
  let userRole = wixUsers.currentUser.role; console.log("User-Role: ", userRole);
});

Please next time try to do exactly what is asked from you → using the console.log of your browser instead of the integrated one, provided by the wix-editor.:wink:
When i do a LOG-OUT, the result will be the following…


So you must do something wrong. I think the user you are logging-in is not an ADMIN.

@russian-dima I just tried out your code and it works! Thank you so much! Terribly sorry for sending you the integrated console.log results. I’ll definitely keep that in mind. Thanks again!

@chocookie22
And to reply your question, which i did not see first time…

Just to clarify, I assign the roles via Dashboard>CRM Tools>Site Members right?

Yes, thats right! Or you generate your own Role&Badge Management-System, like shown in this Login-System-Example…

https://russian-dima.wixsite.com/login-system/vnbadgemgm

More informations about, you will find inside the Login-System itself by visiting the given example pages and setups.

https://russian-dima.wixsite.com/login-system/info

@russian-dima This is amazing! Consider this bookmarked for future references.