Hide Data partly based on User Login

Hi There!

I am new to bubble and loving the experience!

I have a repeating group with content coming from my database of images.
I want to show ALL images to users who have logged in. For the users who have either not logged in or signedup for my application I would like to show only few few images but then LOCK the rest of the images in the repeating group.

Could you kindly advice how to configure this functionality.

Look forward to the response from the community!

Hi arun

You could make an additional datapoint in the database where you have the pictures, for example “logged-in? yes/no”

Then in the repeating group you can either with conditional formatting “lock” the pictures, say they’re there but not visible or you could filter the pictures according to whether your datapoint “logged-in?” ist yes or no.

hope this helps

Hi @arun

Another idea is to just show the first 3 to 5 images and not the rest. To do this set the image or group that holds to be hidden. And set a visibility condition to “when current cell’s index < 5 then visible”.

image

Hi Cmarchan

I have 5 Videos in my Database. I want to show only 3 when the user is NOT logged in and Show all when User is logged in.

I tried the attached conditions based on your recommendation on index.

I am using Google Login for user to login.

It doesn’t seem to be working…What do you think?Bubble Forum_Block Content

Set up the condition as “when current user isnt loggedin and current cells index < 3” this element is visible

I’d set the initial data source to the data shown to users that aren’t logged in, since it’s the first thing the app will load. In that sense Data Source should be “Search for images: until item #3” and then set the conditional for “When Current User is logged in” (in property, select Data Source) and this data should include all images, “Search for images”.

Hope this helps.

2 Likes

Hi Cmarchan

It was fixed using your index idea. Thanks!

Now the items more than the set index value shows empty placeholders in that section. On horizontal scroll I don’t see an option for Collapse when empty. Thoughts?

Many Thanks!

Nest those images in a group and set that group to collapse when hidden

Thats the thing of passing all data and then hiding it, you should always try to pass only the data to show, try my approach and let us know :slight_smile: On the other hand make sure your RG setting is for horizontal scrolling and ONLY 1 Column, the element will add all the necesary columns according to the data you have. If you set 5 Columns, the app will always show at least 5 columns.

Agree. It is always best to pass only the data to show. :+1:

But … as usual with everything … it depends.

In your case @arun I think that @aestela’s approach works best.

Hi @aestela

Thanks for your feedback

I reconfigured my data to include a new field to say Show when logged out Yes or No and tagged the data I would like to show when the user is logged out e.g 3 of the 7 images. When user is logged in I would like to show all 7

Now,

I created a repeating group, Horizontal scroll and one column
Added content type image
Grouped the Image inside a repeating group

Question: As I understand you are recommending to not put a condition but do a search under a repeating group?
Data source : Search for images and then put a constraint show images tagged as Yes.

Thanks
Payal

1 Like

Hi @arun, its easier than that, I just created this demo for you to see the suggested approach:

To test it, you can use any random email to sign up or use:
[email protected]
pass: 1234

Test Site:

Editor Site:

Basically I set a RG, with the following settings:

And the following conditional:

Inside the repeating group, insert an Image Object and set the image source as dynamic with “Current Cells Image”

For this example, the “Images” database only contains the images, no other data which in this case isn’t needed.

P.S.
You can even set the first 3 images to show randomly for the logged out user by setting the search sorting to Random Item.

Feel free to check it out and ask me any other questions I might be able to help you out with.

Best regards.

3 Likes

Hi @aestela Thank you! This worked liked magic. Simplicity was the key to your solution…I kept complicating it so much.

Best
Arun

1 Like