Hi,
Thank you for your time, Let me start by stating again that this is NOT a custom logout button issue (yes I understand that we can use wixLocation.to for custom buttons), this is an issue with the DEFAULT Login Bar provided by wix
I have been looking around the forums and everyone with similar issues seem to have hit a miscommunication issue where everyone assumes that it is a custom logout button and pointed them towards wixLocation.to
My question is how do we actually redirect a user after they logged out back to the home screen?
As it stands if the user logs out in the member’s area they will be prompted to login again, the problem is that the custom lightbox that i have created breaks when the user is prompted to do so and will end up looking like this
(Note the giant arrow)
It is supposed to look like this
(Note the lack of giant arrows)
So I guess to recap my questions;
- How do we actually redirect after logging out from the DEFAULT login bar
- Why did the light box break when it was opened through the logout redirect
Thank you
Put simply for you, if you are using the Wix Members Login Bar, then you can’t edit it at all with any code.
Whatever it does on when the user logs themselves out is what you have to use.
Exactly like Steve has already stated on this previous forum post about it.
https://www.wix.com/corvid/forum/community-discussion/this-is-how-to-logout-and-go-to-the-page-of-your-choice/p-1/dl-5d45f8b65ef2640052982006-5d3db2b85bf7540016a78d69-7
"Yes this is a big headache. The members NavBar that is installed with the Member “App” does not utilise any of the wixUser capabilities. Sadly it is a closed black box with no corvid access. As givemeawhiskey states above. The only way to customise the logout experience is to replace the login navBar and DIY
"
Gah, thats wildly inconvenient, oh well what can you do, thanks so much for clarifying
any idea about the second issue?
I am guessing i’ll just have to create a custom logout page, given that that seems like such a basic feature, it’s kind of mind-boggling to think that they charge 17 dollars a month while still having missing essential features (Custom Forgot Password, looking at you)
Thank you so much for your time
@Alvin
For redirecting on logout with Default Login Bar try something like this…
//place this code on your “site” code page
import wixUsers from ‘wix-users’;
import {session} from ‘wix-storage’;
$w.onReady(function () {
wixUsers.onLogin( () => {
session.setItem("loggedStatus", "user previously logged in for session");
console.log(“login success”);
});
//place this code on the login page that you want them to be re-directed from
import wixLocation from ‘wix-location’;
import {session} from ‘wix-storage’;
$w.onReady(function () {
let check = session.getItem("loggedStatus");
if (check === "user previously logged in for session"){
//note, you should remove the data from wix-storage as suits for your particular site, this is so
//as you do not prevent people continually being re-directed from a page that they are
//trying to legitimately access.
session.removeItem("check");
//after removing item from wix storage then proceed to re-direct
wixLocation.to('https://google.com'); //change this to what ever page you want to redirect too
}
else{
console.log("no previous log in for session")
}
Yeah, I implemented something similar to this by checking the current logged in user
problem is that since it is inside “onReady” the page loads anyway before being redirected, currently I solved the issue by hiding the page until the code deems it safe from redirect, but the light box is still broken for whatever reason
This is amazing except one small correction, you want to remove the item “loggedStatus” not “check”.
Took me a few minutes to figure out what was wrong!