top of page
Crumpled Fabric

2

Reload Your Wix Site After User Logs In

Click URL to copy

Apr 27, 2023

2 min read

WIX Ideas

Tags: Velo by WIX Reload Wix Website Wix Location Wix Members

Reload Wix Page Onlogin() by Wix Ideas

Hello everyone, welcome to Wix Ideas. In this tutorial you will learn how to reload or refresh your wix site after the user logs in.


If you're using Wix to build your website, you're probably familiar with the Wix Members app. It allows you to create a members area on your website, where users can log in, access exclusive content, and interact with each other. But once a user logs in, how do you make sure that they see the most up-to-date version of your site? Or a piece of code you want to run immediately they log in?


The solution is simple: just reload the page using the WixLocation API. Here's how you can do it:


First, import the authentication and WixLocation modules at the top of your code:



Then, inside the onLogin event handler, add the following line:



This will tell Wix to reload the current page as soon as the user logs in. The wixLocation.url property refers to the current URL, so you don't need to worry about passing any additional parameters.


And that's it! Now, every time a user logs in, the page will automatically reload, ensuring that they see the most up-to-date version of your site.


As an additional bonus, you can also update the label of the login button to show "My Profile" once the user is logged in, using the authentication.loggedIn() method. Here's an example:



With this code, the label of the #profileButton element will change to "My Profile" when the user is logged in, and revert back to "Login" when they log out.


In conclusion, reloading your Wix site after a user logs in is a simple but important step in ensuring a seamless user experience. By using the WixLocation API and the authentication module, you can accomplish this task with just a few lines of code.


Code



Leave a comment (0)

Thanks for leaving a comment🎉

bromar

bromar

Sep 29, 2023

Love the tutorial!!!

You are truly great at creating these instructional videos!! Thank you! I am having trouble figuring out . . 'the triggered email' . . it is not being sent to the user submitting the form, the form and the email to the admin works great. . Could you point me to where this might have already been addressed? or any other help? On a second note. .the submit button success/failure message will go back to the default message once it's connected to the data set(I couldn't figure that out either. )

Reply

Admin

kaan

kaan

Jun 4, 2023

wishlist and rating system

hello sir I try today 2 hours but not working if you want I pay money can you do this 2 ( wishlist and rating star) system please I send to you invaid

Reply

Admin

Waqas

Waqas

Apr 16, 2023

Triggered Email Backend

Hi mate please can you send email by backend

Reply

Walter Odibi

Walter Odibi

Admin

Hi Waqas, there isn't a backend code for this tutorial. The emails will be sent from the client-side.

Ghan

Ghan

Dec 29, 2022

Great Tutorial

Hi !

First of all, I want to thank you for your great tutorials, they helped us a lot with the coding.
But I still need your help, if you don't mind. I have based on Save Calculated Field using Wix Data Hooks Codes, to code my form . but the problem is I don't know why the code only reads the computation for "week2" computation and not the "weeks"

here is the code

I also did a separate column in the dataset where the chosen datas for both fields will be placed.

$w.onReady (() => {
$w("#Person").onChange(() => {
$w("#weeks").onChange(() => {
$w("#week2").onChange(() => {
let person = Number($w("#Person").value);
let weeks = Number($w("#weeks").value);
let week2 = Number($w("#week2").value);


$w("#totalLabel").show();

$w("#totalLabel").text = `"${String(weeks * Number(person))}페소"`; //DESIGN YOUR MESSAGE
$w("#totalLabel").text = `"${String(week2 * Number(person))}페소"`; //DESIGN YOUR MESSAGE

});
});
});

});

Reply

Walter Odibi

Walter Odibi

Admin

Hi there, thanks for your comment. I see why this is a problem. The onChange() function seems wrong in combination.

To combine onChangeFunctions use this method

$w("#Person, #weeks, #weeks2").onChange(() => {

//code here

});

Walter

Walter

Aug 8, 2022

More Details? Watch video

Hi, you can click here to watch the video https://www.youtube.com/watch?v=9bx7-nBeZ5c

Reply

Walter Odibi

Walter Odibi

Admin

Walter

Walter

Jul 11, 2022

For you

Reply

Walter Odibi

Walter Odibi

Admin

Walter Odibi

Walter Odibi

Apr 18, 2022

Awesome Feature

This tutorial shows you how to display views on your Wix repeater.

📺WATCH VIDEO HERE https://www.youtube.com/watch?v=Iz7SdaCSdXg

Reply

Walter Odibi

Walter Odibi

Admin

Walter Odibi

Walter Odibi

Apr 18, 2022

Amazing tutorial

This amazing tutorial will show you how to a comment section to your WIX dynamic page.

📺WATCH VIDEO HERE https://www.youtube.com/watch?v=f8-vJQFNZ_c

Reply

Walter Odibi

Walter Odibi

Admin

Walter Odibi

Walter Odibi

Apr 10, 2022

Great Feature🎉

This amazing tutorial will show you how to add a visitor view counter to your WIX dynamic page.

🚩MORE TUTORIALS https://www.wixgenius.com/wix-tutorials

Reply

Walter Odibi

Walter Odibi

Admin

RELATED TUTORIALS 🚀

Copy Wix Page URL to Clipboard

Copy Wix Page URL to Clipboard

Allow your site visitors to easily copy any Wix page's URL to clipboard

bottom of page