Get the information of user roles

Hi Chiu Chi Hung,

You can get a logged-in user’s custom role using the wixUsers module function, getRoles
for example:

import wixUsers from 'wix-users';

$w.onReady(function () {
    wixUsers.currentUser.getRoles()
        .then((roles) => {
            console.log(roles[0]) //output will be: {name: "Student", description: "Student site member"}
        })
});

Hope that helps!

  • Lior