Bobby
January 9, 2022, 4:59am
1
As many of you know if you make an app that allows users to upload pictures and whatnot, Apple requires that you also be able to block users.
I cant figure this one out. Not sure what is stumping me, and I know it can be done, but i’m just hitting a roadblock here.
Any help would be greatly appreciated!
Hi Bobby,
This is pretty easy.
In your user’s collection, create a true/false property called “Blocked?”
Blocking Users By Actions
If Logged In User > Blocked is false , link them to the “Create Post” screen. If Blocked is true , DON"T link them to the “Create Post” Screen. (link them to a screen that says they are blocked.
Blocking Users By Visibilty Conditions
This text will show when the Logged In User is TRUE .
Blocking Users By List Filtering
This list will ONLY show if the user Blocked > is false.
How to Block Users
First, you update the user.
Then, you update the “Blocked?” true/false property to TRUE .
I hope this helps! Good luck with your app!
Bobby
January 9, 2022, 5:25am
3
James,
Thanks. But I think the requirement is that users can block each other. Happen to have a solution for that?
Sorry, I should have been more clear.
So do you mean if User A goes on User B’s profile, User A can block User B’s profile?
If I don’t understand what you mean, can you give me a use case?
Bobby
January 9, 2022, 5:29am
5
Exactly.
Basically Apple wants that If User A is harassed by User B then User A can block User B from contacting them, or even seeing their profile.
Now I know what you mean.
Let me try to wrap my head around this
Bobby
January 9, 2022, 5:38am
7
Thanks!
Ive been trying for a bit. I know it’s possible, but i’m just fried at the moment
1 Like
How about having a one-to-many relationship, e.g. User A blocks (B and C).
And then filter the shown users, so that the user X email (or id) is not part of the blocked users of the current user.
E.g. Email (id) /is not equal to / Logged in User’s / blocked / email (id)
Bobby
January 9, 2022, 6:02am
9
A one to many user/user relationship?
Yes, since user X can block users A, B, C, …
Bobby
January 9, 2022, 6:05am
11
I could be wrong, but when its a user/user relationship the only way to add multiple users to that field is a many/many relationship, which ive tried and doesnt work our right.
It works with my sample app.
Many-to-many is better, if user A blocks B, then both block each other.
However, a one-direction block, e.g. A blocks B, but B doesn’t block B, would be a one-to-many relationship.
Bobby
January 9, 2022, 6:09am
14
So you use two, many to many fields… Let me try that out!
1 Like
Hey Bobby,
I’m almost complete with the cloneable.
You can check it out here: (click “Block user to see”)
Built with Adalo
2 Likes
Bobby
January 9, 2022, 6:35am
16
Thanks, James.
Let me ask you this. Using this method, how would you filter a list of users so that you cannot see any of the users that have you blocked or that you have blocked.
Bobby
January 9, 2022, 6:53am
17
I think I got it… When I blocked the user i was only updating the logged in user, with the user im blocking, I also need to update the current user’s “users blocking me”
What a pain
Thank you all!
2 Likes
Dilon
January 9, 2022, 6:58am
18
Bobby:
Thank you all!
Your Welcome Bobby! Happy to help!
All the best with your app
1 Like
Glad that’s sorted.
I was going to suggest checking the followers tutorial on YouTube and adapt that to blocking users.
2 Likes
Bobby
January 9, 2022, 5:17pm
20
Yeah, I dont know why a double relationship never occurred to me.