Logout redirect works but Lightbox is in the way... Please help my poor brain!

I’ve decided I’m not cut out for coding…!

I have my custom lightboxes all set up, all working perfectly. However - when logging out from a members page, the user is redirected to the homepage (all good), BUT my ‘Sign Up’ lightbox pops up and the user has to click the ‘x’ to then see the homepage.

How on earth do I hide it and stop this? I’ve tried everything I can think of - I don’t need to redirect as it’s already doing that, I just need the lightbox to go away!

Pretty please and thank you for the help.

Really need some help please, this is my code:

import { authentication } from 'wix-members-frontend';
import wixLocationFrontend from 'wix-location-frontend';

$w.onReady(function () {

    const isLoggedIn = authentication.loggedIn();

    if (isLoggedIn) {
        // WHEN USER IS LOGGED IN
        $w('#login').hide();
        $w('#signup').hide();
        $w('#logout').show();
    } else {
        // WHEN USER IS NOT LOGGED IN
        $w('#logout').hide();
        $w('#login').show();
        $w('#signup').show();
    }

    $w('#logout').onClick(() => {
		//WHEN LOGOUT BUTTON IS CLICKED
  authentication.logout();
    });

    authentication.onLogout(() => {
        //WHEN USER IS LOGGED OUT SUCCESSFULLY
       wixLocationFrontend.to("/home");

    });

});

All I need is a way to get the ‘sign up’ lightbox ignored when someone logs out - I’ve tried all sorts.

Thanks

Just make sure that the option Automatically display lightbox on pages is set to No.

This can be found under Site Pages and Menu > Signup & Login > Custom Signup Lightbox > Set Triggers.

Hello again!

Thank you for replying. It’s set to ‘no’ on both - I’ve now deleted them and am starting again, very carefully, to make sure I’m not doing something random. I was on chat with customer care earlier and they told me to delete the form. It was worth a try!

1 Like

You may need to put the wixLocationFrontend surrounded in {} like the like right above it:
import wixLocationFrontend from ‘wix-location-frontend’;
import { wixLocationFrontend } from ‘wix-location-frontend’;

@Pratham I don’t know what I did, but doing it carefully means nothing works now! I’ll restore to an earlier version.

@Wayne_Richmond - thank you, I shall give that a try!

I’m getting SMForm_Error_19974 when I try to login. Google isn’t helping.

Just to let you know I fixed most of it by duplicating my site - may come in handy for someone else reading this.

Now to figure out why “logout” sends me to a 404.

I can do this!!

Thanks for the help - you lot rock! :slight_smile: