Forum Academy Marketplace Showcase Pricing Features

Save data for temporary user into database

Hello, I am a newbie and can’t seem to figure out out to make the following work.

My app will allow users to enter information without having to log in. Users have the option to log in at a later stage on the platform so they can use it without being frustrated by signing up before knowing what they get out of it. Thus, they would be temporary users starting out.

The application works like a multistep survey where users enter information on different pages. I want all this information to be stored with the same user in the same row in the database. The first thing a user has to enter is his/her address. That should start a new entry in the database. All the info that is entered later will be assigned to that user.
I had created a data type (Home) with the fields I want to save (one of which is address) . To create a new entry I used Create a new thing in the workflow when an address is submitted. However, I am not able to get data entries of other questions saved to the same row. I tried 'make changes to things but it only allows me access to ‘Current User’. Current user does not have the field name it needs to be saved into.

How would I need to set this up? Thank you for any feedback!

2 Likes

Hi @ria !
I understand where your coming from with that question, I had the same problem so I created a plugin to help with this!

The plugin is called “Global Variables” and it allows you to save a variable (can be an ID for example) on the users browser (essentially it’s a cookie).

What I would recommend you do is:

  1. Create a thing called “Temp User”
  2. On Page Loaded create a new TempUser only when Global Variable (lets call it TempUserID) is empty
  3. Set the Global Variable TempUserID to the uniqueID of the thing you created in the step before

And there you have it, now the user is “logged in” because you have a way to iddentify him reading that variable (TempUserID) and matching it to the Temp User record you have created.

Here’s the link to the plugin:

Here’s the link to the forum post I created about the plugin:

Try it on my website:

Please tell me if you need further help and I’ll be happy to oblige.

Nice Bubbling :smiley:

Hi Joao,

Thanks for pointing me to using a cookies type set up. I have to look into that. I need users to upload a csv file as well. For now I just wanted to make this work as I need to save data for analytics.

I found a way to save the user entries together in the database (at least on the first try).
The first entry address is set up as Create a new thing/New Type/ and userid=Current user’s unique ID, and address=…
The entries on other pages are set up as follow: Make changes to things with Things to change= SearchforNEWTYPE:firstitem

It worked well when I used it the first time. However, when I used it with a new address it creates new entries for address but all other fields are now empty. The database also erased the uniqueid field that I had set up. I feel I am pretty close to solving this but not quite.

Any feedback is welcome.

Hello again,

You can’t use the Current User object if the user isn’t logged in yet, I think i may have one solution for you but please tell me: is this process using different pages or different elements in the same page ? (do you navigate to another page?)

Current User object if the user isn’t logged in yet. Thanks for pointing that out. That is a bit confusing. I was also trying to make the map view work but now it stays stuck in the first address entry of today. It only seems to accept Current User.

The process is using different pages. One page has multiple elements on the same page. I would like to start a new ‘entry’ (row) every time the user changes the first field (address). The user’s data should then refer to that data row, not the previous ones if that makes sense.
After the user answered a question they will navigate to next page (navigation button serves as the submit button).

If the process occurs through different pages you have a way to send data to another page and read it there.

Send data to another page:

image

Read the data back in the other page


image

With this, you can send the unique ID of the record you create on the first page and make sure you’r editing that same record on the other pages :slight_smile:

1 Like

Thanks for pointing that out. I will look into that. I am new to this so it is a bit challenging at times.

1 Like

It’s ok, we’ve all been through that. Please don’t loose motivation, the Bubble Learning Curve is very steep so soon even if you don’t expect it you’ll be an expert in it, trust me !

Please feel free to ask if you have further questions!

Nice Bubbling :smiley:

Hi Joao,

Do you happen to know if Bubble has a video/case description of this? i followed the interactive instruction 'Save Data to Pages" but it doesn’t clear up all questions as to how I can make it happen.

Here you go https://bubble.io/page?type=page&name=index&id=learn&tab=tabs-1&lesson_ref=9

Hi João,

It seems an interesting solution.

I’m trying to implement a similar use case where I need to identify recurrent users in multiple accesses to the app, without asking for the mandatory login.
Basically what I need is a persistent cookie.
I tried to implement that using “Current User” but it seems that this information is not persistent for a long period of time(days or weeks), the result is that after some days a new user profile is created in my application and I loose track of the real user.

Do you know for how long a “Current user” is persisted on Bubble
s DB?

In the case of your plugin, how would this work?

Thanks,
Felipe.

I had the same problem as topic starter.
Great solution, Joao. Thank you.

1 Like