Button enable to register users only

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

How can i do that?

You can choose who can access your page - whether it is open to everyone, or restricted to members only. Here’s how you can do it:

As for the comment button, that will require a few lines of code (:

Thanks but i want everyone will have access to the page but only subscribe members can click on specific buttons. is it possible?

For that you can use code similar to this:

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();
  }
});

Hi how do you turn off members have to sign up or join to see your website on Wix owner/studio apps?