Session Variables?

How can I set a session variable for a logged in user?

Specifically, I have a user that can belong to several accounts. They need to be able to select which account they want to interact as when they are using the front end, and then change that as they are using it.

Hey @kevinwasie . I am not sure if I understand you, because I know you are very proficient with WeWeb and my answer is pretty straightforward. I have something like this, where one user might belong to multiple “hubs”, and can switch between them by selecting a different hub from a dropdown menu in the nav bar. The “Current Hub” is a variable that changes upon selection of a new hub. All relevant data are then filtered by the “Current Hub” variable, so they are only seeing the data for that hub.

Does that sound like what you are trying to do?

Hahah I appreciate the vote of proficiency… I just guess most of the time until it works lol…

I am trying to make it so that the variable carries over from page to page, and stays as it is until they logout, or they change it.

So, if they are on one page, and they select that they want to utilize their “foo hub”, then when they go to the next page, that variable is still set to “foo hub”

Doesnt the hub change every time they change pages in your scenario?

Oh, so for that, I toggle on the “Save in Local Storage” option. Have you tried that?

1 Like

Awesome! I did not know what that toggle did. Thank you!

1 Like

Wait. If a user logs out, does that variable change? If not, you could have someone on a public computer have an old variable in there, unless it’s cleared at every login/logout.

Yes, I have it reset at login and logout

2 Likes