Hi all! New bubble user, and trying to set up a difficult build. Basically, I want to build a feed of photos in a repeating group that will scan my first data type to see if the current user is listed as a “follower”, then output all photo posts created by people they are “following”.
I have two data types:
Followers
Photos
Photos contain all post information from the user who submitted.
Followers contain “Follower” (the current user) and “Following” (adds the current page user account as a followed account of the follower.
How can I do this? I’ve tried a lot of different methods but can’t find a way to get it to scan one and then output the posts (photos) that were created by people from the first data types “Following.”
Thank you for any support!
I might not be understanding this so let me know if I’m going down the wrong path, and I’m just doing this from my head so let me know if it throws any red errors but:
Try making the data type for the repeating group Photo, and make the data source Do a search for Follower
with a constraint Following
contains Current user
then hit ok on the little window, then do :each item's Photos
after. Then you can do :sorted
and you can sort by Created Date and make descending Yes to show the most recent posts.
Hi thank you for responding! That does work as a blue text, but it doesn’t actually do what it is supposed to do (nothing is output).
I wrote that all last night so hopefully this is a little bit better understanding because I still haven’t figured it out, and I appreciate the support :).
So basically, I want to use photos as the Data Type, but I want to force it to filter the results through “Followers” data type, confirming that current user is listed as a “Follower” then pulling any Photo data that has a “creator” user that matches the user in Followers > “Following”.
I hope that makes more sense, and I attached photos
Okay yea the filter can be done probably I just need to think about this still but if you don’t mine me asking, is there a reason in your data structure the type User doesn’t just have a “Followers” field with list of Users? And a “Following” field with a list of Users? Then if you wanted to lookup all photos from Users the current user is following, you just do a similar search to my last post.
Maybe I’m completely misunderstanding but I just want to make sure your data structure isn’t overly complicated because then it makes your workflows complicated.
I did do this, and it works:
Created a “Following” field set as List of users, and added that field type to the “User” Data Type.
Created a workflow on a follow button that set up two parameters:
Workflow > When “Button” clicked, added constraint "Current User “Following” does not contain “Current Page User” > Make changes to a thing > Current User > Following add “Current Page User”.
And basically the opposite to make the button set to unfollow.
This updates the “Following” Field type in the User Data Type.
Then, in my repeating group of photos, I added the Data Type to be “Photos” > Data Source "(do a search… selected data type “Photos” and exited) Search for Photos: filtered > on the pop - up set parameters to "creator is in Current User’s Following.
This allowed it to pull the “feed” of photo content filtered out.
I guess it’s to separate the following list. I wanted to see if there is a way to force this same concept to happen, I’ll play more but anyone reading this that is a way to do this (as I have been reading a ton of stuff on these boards lol).
Yea I just wanted to check your data structure if it could be changed.
What you wanted to do is use the Advanced: filter. When you do your search for Photos, don’t put any constraints, click ok on the little window, then after the search do :filtered
then in the new window make the operator Advanced:
. Now you’re free to do any logic you want as long as it ends with a yes/no result.
Awesome! I’m going to test it and I’ll report back on my findings. I appreciate you a ton
1 Like
Yea for sure, right now I can’t fully read your filter you need and test it on my own app, but later on today I probably can.
For the Advanced filter you can also do things like Do a search for Photos (with a constraint Follower = Current user):count >0
so you can get a yes/no result by searching for something and checking if there’s 1 or more results. There’s little tricks here and there to do what you’re looking for but it probably requires “Nested searches”
Hi there! Reporting back.
So setting the repeating group to “Photo” and data source to “Do a search > Photos > :filter” and then set up these constraints:
First half works fine, it pulls any photos who’s Creators match the following tab.
Second constraint is the issue, it is a valid formula, but it is ignoring that the user also must be the current user. So it’s just pulling up a list of photos with the first parameters. Any ideas?
Sorry I was unavailable, let me mess with it a little bit on my test app. What’s throwing me off is you have the intermediate type called Follower instead of just listing a User as a follower of a User. Hang on while I test a few things
Hilariously, the solution to this hit me Sunday morning in the early morning when I couldn’t sleep. So anyone that needs this:
Set repeating group’s Data Type to the content Data Type you want; for me “Photos”
Set the Data Source to:
"Do a search for … "Photos (the data type you are wanting) :filter { Creator = "Do a search for… Followers (the other Data Type you need to search) [add a constraint: Follower(this is the Field type you need to sort by first) = Current User"
Then close out of the “Do a search for… Followers” and add
:each item’s Following (the Data type you want as the second search).
So for me, I wanted it to check the Data Type “Followers”, constrain the search results to only ones containing current user (first constraint) and then I wanted the “Following” list to match the Creator content from the Photos Data Type.
This created my photo stream. Hope this helps other people who are crazy like me! .
1 Like