Hi @francesca8121987
Thanks for reaching out! With the Popups for Divi plugin this behavior is a little difficult to implement:
The first step is, to set the button Link URL to the target page for logged-in users. Next, you create the Popup for guests – now the tricky part: You need to write some custom JavaScript logic to initialize the button based on the user’s login state. That’s a quite advanced usage of the JS API (but possible!). The core part is:
js
jQuery('.button-selector').on('click', function(event){
DiviArea.show('popup-id'); // ← Display the Popup on button click.
event.preventDefault();
return false;
})
Just note, that even logged-out users can see the button URL in the HTML code. With the free plugin, you cannot remove that URL from the HTML source…
—-
The easier solution would be our premium plugin Divi Areas Pro which has a ton of advanced options in the Divi Area editor.
You need to enable the “User Role” condition and enable the Popup for “Guests”. Then add a new Trigger to the Area (Click-Trigger with a CSS selector to identify your button).
→ The result is a Popup Area that is only loaded and attached to the button when the user is a guest. As soon as the user logs in, the Area is not loaded anymore and the button will keep the default behavior and direct the user to the button Link URL.
Tip: With the Pro plugin, you can display a separate button for logged-out users that does not contain the members-only URL. You can do this with a static Inline Area that replaces the button with a “dummy version” for guests.
I’m happy to help with the configuration of the Areas (preferably via our Live Chat on divimode.com)
Btw: We’re having a Black Friday sale right now, so it’s a good time to test out the pro plugin 😉
Philipp