Search code examples
phpdiscourse

How can I disable / deactivate / delete a discourse user account via php?


I use for my discourse site my own registration and SSO via discourse-api-php and LDAP. Is there some option how to disable, deactive or delete user via php? Because when I delete/deactive user account in LDAP, user profil at discourse portal is still active and I wanna have every user-management on one page.


Solution

  • According to this post the route to suspend a user is

    /admin/users/:user_id/suspend
    

    The controller for this is here - it accepts the parameters duration and reason.

    This function isn't in the library you are using, so you'll need to add it yourself to use it.