Hiding menu for visitors

Hi,
I would like to hide my menu for visitors and show it to members. Currently I used wix code to show it for members, however after login members still need to refresh the page before they see the menu.

Do you know how to refresh the page after login or do you know an alternative to reach my goal?

Thank you!

Hi,
It’s not the best solution, but it would help you for now.

you could check if the user has logged in every 1 second. so if he logged in you could make your changes.

var userEmail= null ;

checkLogin(); 

function checkLogin(){
let user = wixUsers.currentUser;
user.getEmail()
.then( (email) => {
userEmail = email;
} );

if (userEmail=== null )
setTimeout(checkLogin, 1000);
else{
// show the menu by $w(‘#myelement’).show()
}
}

Hi,
You can know that a user logged in with the onLogin function.

Good luck :slight_smile:

Much better :laughing: