I have a website with a login page, user need to register to gain access to several pages (like programs).
In addition to that, i have a comment section. i want to enable the button “add comment” only to register users.
If the user is registered > open the lightboxes page
if the user doesn’t register > open the “register” page
import { authentication } from 'wix-members-frontend';
$w.onReady(async () => {
const isLoggedIn = authentication.loggedIn();
if (isLoggedIn) {
// WHEN MEMBER IS LOGGED IN
$w('#button').enable();
} else {
// WHEN MEMBER IS NOT LOGGED IN
$w('#button').disable();
}
});