Helping to separate members-specific pages by roles and at the same time to show restricted to new visitors.

Hello there;
We can edit roles and access privileges according to groups on member-specific pages. But I am looking for a solution;

If a page is open to public visitors (with new visitors) (with restricted access), is it possible for members from the members to work according to the access role?

I would like to hide a certain part of the page with the strip and give access according to the membership type to redirect new visitors to membership.

but as far as I can see, I couldn’t do both at the same time. How can I do it.

I can set a page according to the roles of the members as well as show them to some of the public visitors.

I need help for an example or code

Solution; Steps

  1. Open the page to all visitors in general.
  2. Create membership groups for members
    Prepare strip messages that will appear to non-members or those who are not authorized to access page 3.
  3. Make arrangements based on the following code.

Note: change to show () / hide () for the element you don’t want to appear

import wixUsers from ‘wix-users’;
$w.onReady( function (){
const currentUser = wixUsers.currentUser;
if (currentUser.loggedIn) {
if (currentUser.role === ‘Paralı’) {
//show or hide elements here:
$w(‘#html1’).show();
}
if (currentUser.role === ‘Admin’) {
$w(‘#html1’).show();
}
if (currentUser.role === ‘Admin’) {
$w(‘#columnStrip7’).show();
}
}
});

import wixUsers from ‘wix-users’;
import wixData from ‘wix-data’;
import wixLocation from ‘wix-location’;
$w.onReady( function (){
const currentUser = wixUsers.currentUser;
if (currentUser.loggedIn) {
if (currentUser.role === ‘Asia Continent’) {
//show or hide elements here:
$w(‘#html1’).show();
}
if (currentUser.role === ‘Admin’) {
$w(‘#html1’).show();
}
if (currentUser.role === ‘Admin’) {
$w(‘#columnStrip7’).hide();
}
}

});

///

$w.onReady( () => {
setupPage();
wixUsers.onLogin( (user) => {
setupPage();
} );
} );

export function setupPage() {
if (wixUsers.currentUser.loggedIn) {
$w(“#html1”).show();
$w(“#columnStrip7”).hide();
}
else {
$w(“#html1”).show();
$w(“#columnStrip7”).show();
}
}