Forum Academy Marketplace Showcase Pricing Features

What is the impact of “current user” versus using parameters in the URL?

I’m having trouble wrapping my head around this concept. I’ve watched a few bubble tutorials online, and I understand the concept of passing parameter data by [?id=current user’s UserID]

What I don’t understand, is why it’s important.

For instance, when I’m setting certain conditional formatting on certain elements, the conditions won’t work the way I want when I’m using parameters and doing a search for current user based on parameter ID. But then if I switch it to Current User, I have no issues with the conditionality I’m trying to achieve.

What am I losing by going the “current user” route?

I don’t know if it’s appropriate, but I think of the ‘Current User’ more or less as a ‘shortcut function’. By using the ‘Current User’ option you’re bypassing the need to create a search by ID in the first place. In addition, you may set a type on thing on a group on a page and always refer to that group as the master element or search function.

It all depends on how exactly you’d like to reach your end goal. I’ve achieved a lot of similar conclusions and functions in Bubble using a large variety of methods. Ultimately it comes down to your preference, the preference of your user base, and anyone else involved. This means assessing speed (does running a search one way increase or decrease loading time of your app? Best to pay attention and find out!) as well as settling on a consistent way of creating pages and elements within your app.

In my case, I am building a one-page app. I set the type of ‘thing’ on my UI groups after doing a search for a string in the URL (via Get data from page URL). I nest all this in repeating elements so that I’m not re-writing and re-programming all the workflows each time.

I can post more details if you have question on a specific detail or two.

You’re not losing anything by using “current user” - it’s another way of identifying the current user through a “built-in shortcut” as @philip described. The url parameter route and the “shortcut” route are just two different methods with different advantages and efficiencies. Identifying the current user is much, much easier via “current user” since you don’t need to search for it.

To find the current user (or any user whose Id is in the url parameter for that matter), your expression would be “do a search for user: first item, constraint: unique ID= get data from URL (where parameter=ID)”. So to retrieve the current user’s name, for example, you’d have to go through all of that search trouble to create “do a search for user: first item’s name” when you could just do “current user’s name.”

Examples of where the url parameter is useful: sending data that might not be stored in your database Iike a form response that needs to be carried to the next page but not saved yet, a referral code shared outside the app, or states unique to the current user’s experience like taking the user directly to an FAQ question from another page (e.g. They click a reference to the FAQ, passes a parameter to indicate it, and when on the page, it scrolls directly to it).

If the page in question is set to a data type, then you’ll more often than not be able to send the data of a specific Thing when navigating to the page directly in that workflow and do nothing more. Then, when on the page, you’ll have access to the “shortcut” of “current page’s Thing” and all its fields for the specific Thing the page is reading.

Hope this helps.


Gaby | Coaching Bubble

3 Likes

Current User is a User object, it has all the fields that you create in the User collection. My understanding is that for Logged in users, the data is as per the data that you have in your applications User table. Logged out users are still a User object, but the data is ‘visible’ in the same way, is not permanently there (expires after 3 days) and managed by the backend.

By using Current User you know what you are dealing, passing parameters by URL can more easily be manipulated, url paramters are also text, so you have to consider that when trying to deal with them at the receiving end.

Hi romanmg, on a related note… I am completely stuck trying to pass data from a Data Type called Student to a Group Container based on a parameter in the URL. I keep getting this error:

What am I doing incorrectly? i.e. why does Bubble think I am referencing the list and how can I reference a specific row in the Students Data Type please? Thanks so much for your help!

@collegefund.me Add :first item to that search so that it reads “Search for Students :first item”

A group source should only be one item, but a search expression returns a list value (even if you know that specific search will only match 1 item), so you need to modify the search so that it only returns one item.

Also, make sure to click again on “Get data from page URL” to define the URL parameter you want.

Wow, thank you Gaby, that worked! I was getting hung up on the need to call :first item.

Really appreciate your help!

1 Like