Block users via API or other?

api

(Darren Reid) #1

Currently trying to maintain a list of users external to discourse which will update on a regular basis due to subscription status of each user.

I can see that you can update a users title, for example, via the API but trying to update ‘blocked’ by send a PUT request to /users/{username} doesn’t change anything. Also tried /admin/users/{usersname} but get a 404.

Use case is:
Want to block users who don’t have an active subscription.
Want discourse to manage user auth and management.
External list is updated daily.

Any tips/advice would be appreciated. Cheers!


(Kane York) #2
  1. Make a test account
  2. Go to suspend it with the message “subscription expired”
  3. Open browser developer tools, network panel
  4. Write down the request details

(Darren Reid) #3

Thanks for the tip. I common trick I’ve been using.

Not looking to suspend a user, but to block them. I’ll keep it in mind as an option. Thanks!


(Kane York) #4

What do you mean by “block” exactly? Prevent them from reading the site?

If your site is login_required, a suspension will prevent them from reading.


(Darren Reid) #5

Ahh apologies, I think I’ve misunderstood these two options on the user page.

Looking at this and what you have said, I think suspending a user makes most sense! Thanks again for your help!