Saving information and retrieving it specific to a user (but not using user table)

I would like to have a second part of my site that controls users and sessions!

I am using the user table to manage live users of the site but I want to be able to have a second part of the site where people can enter an email and a unique code so they can store temporary information. They will be entering some information but not using the full site. The email and unique ID would effectively be logging them into the session.

Not sure if I could/should be doing this with session ID’s or similar but effectively someone can fill some information in, save it and come back later on to retrieve it. I dont want to use the same table as the main login area ideally (unless there is no better option!)

Are these users going to be ‘logged in’ or ‘not logged in’

Either way, my understanding is (I don’t know because I have not tried it) is that they can create and retrieve information, and it is accessible as ‘current user’. If they then go on to create a user account, then they will have the ability to retrieve the information in subsequent sessions.

If they do not create an account, the information will available for the duration of that session.

So in theory you should be able to create a new table/data type and store session data. You shouldn’t need to access the user table at all. You should be able to build a very small simple page to test this. Sorry I can’t be much more help than that.

Hi @rash thanks for the reply.

we already use the users table to be able to store information and retrieve to the screen but this is for the main users of the application that come back time and time again. I am ideally looking for a way to store information that someone may come back once or twice but they are not a main user of the site - rather use one function of the site for a limited time.

Ideally I dont want to use the main users table as that has been reserved for the users of the main site. I just need a place where effectively someone…

  1. leaves an email address and a password/code (so they can come back again if needed to complete other parts of the form)
  2. this information is then used in a couple of other pages during the session (so need to be able to write back to a table to store information)
  3. the ability for the user to come back later on to complete the form.

I think I have a two main options.

  1. adapt the user table and every page (there is a lot!) to identify if this user is a full site user or just going to be using the small functionality
  2. create a new table to store email and perhaps a code so that users can ‘log in’ and use the details via a session. This session is then used to write data to a table whilst the session is live.

no 1. contains a lot of work and subsequent testing but I think it probably is the best option - but I ideally want to keep the permanent and temporary users separate.

Hi.

If I understand you correctly then it seems to me that you have 2 user types.

  1. Full site user
  2. Temporary user

You could have an authentication flow for each user type.

  • Full site users log in normally, and their user type is set to ‘Full’

  • Temp site users provide their email and ‘code’ and their user type is set to ‘Temp’. This can be checked against the separate user table as you mentioned.

Once you have established the user type you can check this on each page to determine which pages the user does/doesn’t have access to.

If you use something like the Env plug in, you could set this once at time of authentication and then access the environment variables on each page by adding the element and a condition to check the user type.

Again, I would test this or any of your other ideas first on a couple of pages to determine which is best for your app.