How to ban a user

Hi, I implemented a feature that I’m able to ban a user. (It’s a true/false property in the database)

I tried it in two ways:

  1. When the page is loaded and current user is banned is yes, then log him out and go to the index page.

image

  1. When the user is logged in and current user banned is yes, then log him out and go to the index page.

image

But both ways don’t work. Does somebody know why and how I can set up it properly?

Best wishes
Jakob

Hi there, @Jakob1… if I understand your post correctly, I think the first workflow should work if you ban a user and then they try to navigate to a new page. However, it seems to me like you need to add the log out and go to index steps to the workflow in which you are setting the user’s ban field to yes. So, set the field to yes, and immediately log the user out and send them to the index page. Have you tried that already?

Best…
Mike

Thank you for your answer. I ban the user manually in the database and not through a workflow.

Okay, I just tested this and it appears to work. Create a workflow using the Do when condition is true workflow event, add a condition to the event so it runs only when the user’s ban field is set to yes, set the event’s Run this field to Every time, and add actions to the event to log the user out and go to the index page.

1 Like

Ok, I’ll try it, thanks. Should I put something in the workflow folder, or just leave it blank?

You can leave it blank… that has nothing to do with the functionality (it’s for organization purposes only).

1 Like

Oh, the issue was that the field “user is banned” wasn’t checked in the privacy section in the database. Now everything works, thanks :smiley:

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.