Is it possible to "Show" a specific button when logged out and "Hide" it when logged in?

Question:
The Wix Member App login design is so bad that I want to link to it with a button. I want the login button to appear when I’m logged out, and disappear when I’m logged in.

Product:
Wix Editor, Wix Studio Editor

1 Like

With a little bit of code, you sure can :slight_smile:

Something like:

import { authentication } from "wix-members-frontend";

$w.onReady(function () {
  const loggedIn = authentication.loggedIn();

  if (loggedIn) {
    console.log("Logged in, show the button");
    $w("#button").show();
  } else {
    console.log("Logged out, hide the button");
    $w("#button").hide();
  }
});

1 Like

And if you want a login button at the top of every page, place the button inside your page header and add the code to masterPage.js.

1 Like