Forum Academy Marketplace Showcase Pricing Features

Save user session data - how do I send user the the page she's been last time?

Hi everyone.
I suspect my problem has already been solved but 2 hours of search through the Forum has yielded nothing so I figured I’d better ask.

I have an app where users watch educational videos grouped by modules and classes. I basically need to redirect logged in user to the previous session results. That is if a user has already gone through module 1 class 1 when she logs in next time she should be directed to the lesson 2 etc. It does not mean that I want to close access to previous lessons and certainly a user could search manually where she’s been but it’s not the best consumer experience is it?
So how do I do it?

If this has already been solved I appreciate a link

Hey there! :wave:

I normally would create a field for the user called “lastPageVisited” or something like that. Then depending on that field, you can show what you want. If the current user’s lastPageVisited is 1-2 then show this information. If it’s 1-3 then show this instead.

There are a lot of ways to do that.I normally use set states to do that, but I don’t want to overcomplicate it for you. You can implement it how you wish.

Does that make sense?

Hope that helps! :blush:

@j805 www.NoCodeMinute.com

For All Your No-Code Education Needs:

  • One-on-One Tutoring
  • eLearning Hub
  • Video Tutorials
  • No-Code Classes

Hi there. Thank you for you reply. Unfortunately it still does’t make much sense to me. If I follow the path with a new field how do I make an actual reference to the last session? What type of field is it? It’s not text or number or date or file. Do I have to have a data thing with it (like Page visit) and every time a page is loaded by a user create a new thing? But that looks like a way to overpopulate a database without much efficiency.
The idea with the set state looks more promising. Would you please elaborate how exactly do you suggest to solve my problem with the set state?

Set states are just temporary pieces of data, so storing it there for the user’s next visit to the site won’t work. There could be some workarounds with a plugin, but essentially the idea is to have it permanently saved into your database so the user can access which page they were on previously.

So on each page load you can check the “lastPageVisited” (as a text field) and then redirect the user to the correct page.

For the sake of time I created a very simple one-page app example. The user can choose a ‘page’ from the menu at the top. If you refresh the page it will reload which one you were currently on before. It won’t start back at Page 1.

Bubble creates a temporary user for the browser session, so this works. In your example it will be more robust.

Editor: https://bubble.io/page?type=page&name=examplelastpagevisited&id=805testapp42&tab=tabs-1

Preview: https://805testapp42.bubbleapps.io/version-test/examplelastpagevisited?debug_mode=true

Hope this example helps a bit! :blush:

Thanks! It sounds like a great solution to my problem. Appreciate your help so much :smiley:

1 Like