Change ownership of all posts by a specific user

:bookmark: This guide outlines the process to change the ownership of all posts by a specific user. This task requires console access.

:person_raising_hand: Required user level: Server administrator with SSH access

In Discourse, there may be situations where you need to change the ownership of all posts by a specific user. This guide provides the steps for achieving this on self-hosted Discourse instances. If you’re using Discourse hosting, please contact the support team at team@discourse.org for assistance with this process.

Access your site

  1. Connect to your Droplet via SSH.

  2. Enter the Docker container for your Discourse instance by running the following commands:

    cd /var/discourse
    ./launcher enter app
    

Changing ownership of all public posts

To transfer ownership of all public topics/posts from one user to another, use the following command:

rake users:change_post_ownership["old_username","new_username"]

Replace old_username with the current owner’s username and new_username with the new owner’s username.

Changing ownership of all private posts

To change the ownership of all private messages (topics/posts), execute the command below:

rake users:change_post_ownership["old_username","new_username",private]

Again, replace old_username and new_username with the relevant usernames.

Last edited by @SaraDev 2024-10-30T23:17:15Z

Check documentPerform check on document:
22 Likes