SOLVED - Membership groups for different website functions

Hey all!
I’m currently in a little dilemma because I have to figure out a way to have 2 types of membership for 2 very unique outcomes.

As it stands, I currently use my existing active wix.users membership to determine if Advertising-banners should be displayed (basically, if they donate I grant them membership which in turn removes the Ads everywhere) but now I need to find a way to have a 2nd membership level where members can sign-up and be able to post content on à certain section of the website, regardless if they should be seeing Ads or not.

Essentially, is there a way to code some sort of membership-type where a member can be any combination of these conditions:

  1. See Ads / not see Ads
  2. Can post articles / Can’t post article (on uNews)

if not, can I create a distinctive sign-up process for users to sign up exclusively to post content…? That said, I’d prefer 1 membership sign-up to rule them all… Any feedback or previous examples i could rely on would be much appreciated (though I couldn’t find none).

Thanks for your time!

website:
emunations.com

Hey,
Thanks for the reply…!

If I set currentUser.role === ‘Admin’ ; it works!
If I set currentUser.role === ‘VIP’ ; it doesn’t work…


import wixUsers from ‘wix-users’;
$w.onReady( function () {
if (wixUsers.currentUser.role === ‘VIP’){
} else {
$w(“#groupAds1”).expand();
$w(“#groupAds2”).expand();
$w(“#textNoAds”).expand();
}
});

I also tried via getRoles but it didn’t work (I assumed VIP length === 3)

import wixUsers from ‘wix-users’;
//$w.onReady(function () {
wixUsers.currentUser.getRoles()
.then( (roles) => {
if (roles.length === 3 ) {
} else {
$w(“#groupAds1”).expand();
$w(“#groupAds2”).expand();
$w(“#textNoAds”).expand();
}
});

In the Dashboard > Site Members > Member List, I defined a dummy-member’s “Role” as VIP for testing purposes.

I am missing something??

I switched to the right account, didn’t realize I was posting using my Admin acc…
This works! (for future inquirers)


import wixUsers from ‘wix-users’;
//$w.onReady(function () {
wixUsers.currentUser.getRoles()
.then( (roles) => {
if (roles.length > 0) {
let firstRole = roles[0];
let roleName = firstRole.name;
if (roleName === ‘VIP’) {
} else {
$w(“#groupAds1”).expand();
$w(“#groupAds2”).expand();
$w(“#textNoAds”).expand();
}
}
});

I don’t think it’s the cleanest code, but it works…
Any feedback will also be appreciated

1 Like