Hello!
I have been digging through forum posts for hours now and cant seem to make any of the code work on my page…
I am adding the code on the page I want the lightbox to pop up on, not the actual lightbox page code.
I have my lightbox set to collapse on load and NO automatic display.
I would greatly appreciate any insight or tips, there has to be a way to do this. Even though many of the past posts about this didn’t really see to end up with success for anyone I still have hope!
GOAL: Light box to pop up (on this specific page, or better yet all pages) unless a member is logged in.
import wixUsers from ‘wix-users’;
import wixWindow from ‘wix-window’;
$w.onReady( function () {
let user = wixUsers.currentUser;
let isUserLoggedIn = user.loggedIn; // true
if (isUserLoggedIn) {
wixWindow.lightbox.close(“passwordEntry”);
} else {
wixWindow.openLightbox(“passwordEntry”);
}
});