Lightbox for members only

Hi,
I have a lightbox that pops up when the page loads.
How can I make it pop up for members only?
How can I make it pop up only for members with a specific role?
Thanks,

#lightbox , #members , #role

try something like this…

import wixUsers from ‘wix-users’;

$w.onReady( function () {

$w(‘#button1’).onClick( function () {

if (wixUsers.currentUser.loggedIn) {

wixWindow.openLightbox(“lightboxName”);

}
})
})

Hi Mike,
What do you mean by ‘$w(’ #button1 ‘).onClick( function ( )’ ? (The lightbox is not supposed to get triggered by a button, it should automatically pop up)
Also I guess I need to import winWindow as well. Right?

Could you clarify please?

Thanks a lot!
J.D.

@jonatandor35 If you don’y want it triggered just remove the onClick, yes import wixWindow

@mikemoynihan99 , It works. Thank you very much!

@jonatandor35
no problem

Anyway to limit to certain members (paid membership members) and not just “regular” site members?