Forum Academy Marketplace Showcase Pricing Features

Current user is not logged in. How to access current users something?

Hi @emmanuel

I m having a little trouble here, maybe is not possible.
I do not require users to login and create an account but as far as i know, a temp user still exists.

I have the following setup:

  • users can create their own customized watch.
  • when the page is loaded and current users temp_order is empty, i am creating a temp_order then make changes to user - temp_order=result from step 1 temp_order. So right a way, after user has accessed my page, they have a temp_order assigned.
  • when they press “checkout” i m making changes to currents user temp_order. Everything works perfect.

Now, after user refreshes the page i have 2 conditions:

  1. temp_order is empty - the scenario from above happens
  2. temp_order is not empty

I m having issue in setting states from current user temp_order. For some reason, it does not work.
It will only work if i “do a search for” temp_orders created by current user. (but i want to avoid do a search for as much as i can.)

If i have the users logged in, it works without any problem but in my case i cannot see the "current user " in database
Link to page: https://noah-test2.bubbleapps.io/version-test/configurator?debug_mode=true
Link to editor: https://bubble.io/page?type=page&name=configurator&id=noah-test2&tab=tabs-2

hi @emmanuel. anything related to this?

Hey @cm1,

If the user isn’t logging into a user account of any kind, it’ll be difficult to locate their temp_order in your database by user for a variety of reasons. You’re right, the “current user” doesn’t get saved to your database if they’re not intentionally a part of your User data type.

My suggestion is to give them an order # which they should make note of and you also save to the temp_order that is saving to your database.

Custom states will reset Everytime the page refreshes or navigates away, so unless you pass custom state values to pages for the visitor in 1 sitting, things could get lost quickly.

So, as far as I can see, you still need to “do a search for temp_orders” but it may be more stable with an actual value assigned to the order and the person who created who can humanly take note of it (versus a page visitor who may be a different human…)

Oh you could also create a “guest login” system where you just collect an email address to locate their temp orders. So the data type would be “Guest” with fields for email (text) and Temp Order. That way you’re saving users to an extent without actually signing them up.

Would this work for you?


Gaby | Coaching Bubble

Hi @cm1, my understanding is the Bubble automatically uses cookies to keep track of users. So, you can store stuff in the database for that user even though they never logged in, and you can retrieve that same information from the database when they come back later, so long as they come back on the same computer (with the same cookie still intact – i.e., not deleted).

Additionally, as @romanmg mentioned, custom states are temporary. They exist on the client side and are lost as soon as soon as the page reloads. If you’re looking to store something more permanently, then save it to the database.

Also - why are you wary of using “search for” capabilities? This functionality is a core capability and highly performant, so long as you’re returning a small amount of information (in this case, information for a single user). So, perhaps there’s no reason to avoid using it in this scenario.

Best of luck!

2 Likes