# Block user function

**URL:** <https://community.glideapps.com/t/block-user-function/56193>\
**Category:** Ask for Help\
**Created:** [December 31, 2022, 9:01am UTC](https://community.glideapps.com/t/block-user-function/56193 "2022-12-31T09:01:47Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![OnlineNorwegian](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/onlinenorwegian/32/39226_2.png) [@OnlineNorwegian](https://community.glideapps.com/u/OnlineNorwegian)\
**Post date:** [December 31, 2022, 9:01am UTC](https://community.glideapps.com/t/block-user-function/56193/1 "2022-12-31T09:01:48Z")

</div>

Hello,  
Creating a public app with Glide apps. We need a “block” function where users can block each other, so when one user is blocked by another. They won’t be displayed to each other in the app.

I thought of using a relation, but that doesn’t seem to work fully. I’ve done it so that if user (1) now press “Block user” on the profile of the user (2), the email of user (1) will be listed under a column called “Blocked” under user (2) with user (1)'s email.

How would I proceed? Have I done something right.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [December 31, 2022, 9:38am UTC](https://community.glideapps.com/t/block-user-function/56193/2 "2022-12-31T09:38:58Z")

</div>

Assuming that:

- You’re not using Row Owners, and
- Each users block list contains a comma separated list of email addresses

Then create a single if-then-else column:

- If BlockedUsers includes User Profile → Email, then true
- If User Profile → Blocked Users includes Email, then true

Then use your if-then-else column as a filter.

 ![Screen Shot 2022-12-31 at 5.42.35 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/0/90fbf817ce6b8f7663fde3944457b8a06f46f4df.jpeg)

 ![Screen Shot 2022-12-31 at 5.43.17 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/6/a68f2dbd36211f9d0a62c8c7e9e9a5dc1933345a.jpeg)

---

<div class="post-metadata">

**Author:** ![OnlineNorwegian](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/onlinenorwegian/32/39226_2.png) [@OnlineNorwegian](https://community.glideapps.com/u/OnlineNorwegian)\
**Post date:** [December 31, 2022, 9:46am UTC](https://community.glideapps.com/t/block-user-function/56193/3 "2022-12-31T09:46:37Z")

</div>

Thanks, a lot Darren! This made my day by far.

One last question, what would be the best approach to make the button that users click to block this user? Because with using a “add row” it adds a completely new row I just want the users email to be added to the BlockedUsers list when clicked.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [December 31, 2022, 9:53am UTC](https://community.glideapps.com/t/block-user-function/56193/4 "2022-12-31T09:53:39Z")

</div>

The easiest way would be to use a Choice component with multi-select enabled, and target it at the BlockedUsers column in the User Profile. You need to ensure the screen it is on is sitting on top of your Users table, and is filtered by signed in user. The obvious place to have it would be on the same screen where users manage their profile.

If you wanted to do it with a button/action, then it gets more complicated. You’d have to start using some variation of the trebuchet method.

---

<div class="post-metadata">

**Author:** ![OnlineNorwegian](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/onlinenorwegian/32/39226_2.png) [@OnlineNorwegian](https://community.glideapps.com/u/OnlineNorwegian)\
**Post date:** [December 31, 2022, 9:56am UTC](https://community.glideapps.com/t/block-user-function/56193/5 "2022-12-31T09:56:25Z")

</div>

Yes the choice variant you mention works well, but it will display all emails in the table.?

---

<div class="post-metadata">

**Author:** ![OnlineNorwegian](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/onlinenorwegian/32/39226_2.png) [@OnlineNorwegian](https://community.glideapps.com/u/OnlineNorwegian)\
**Post date:** [December 31, 2022, 9:56am UTC](https://community.glideapps.com/t/block-user-function/56193/6 "2022-12-31T09:56:50Z")

</div>

Nevermind I take “display as” name

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [December 31, 2022, 9:57am UTC](https://community.glideapps.com/t/block-user-function/56193/7 "2022-12-31T09:57:00Z")

</div>

It will if you don’t filter it 😉

---

<div class="post-metadata">

**Author:** ![OnlineNorwegian](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/onlinenorwegian/32/39226_2.png) [@OnlineNorwegian](https://community.glideapps.com/u/OnlineNorwegian)\
**Post date:** [December 31, 2022, 9:59am UTC](https://community.glideapps.com/t/block-user-function/56193/8 "2022-12-31T09:59:15Z")

</div>

Thanks again, Darren. Happy new years eve!

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [January 1, 2023, 9:59am UTC](https://community.glideapps.com/t/block-user-function/56193/9 "2023-01-01T09:59:55Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
