This guide explains how to merge multiple user accounts into a single Discourse account. It covers merging non-staff users through the Discourse UI and merging staff users via the console.
Required user level: Administrator
Merging user accounts in Discourse allows you to combine multiple accounts into a single one. This process can be useful in several scenarios:
- When a user creates multiple accounts, perhaps due to forgetting their previous registration.
- If a user creates a new account with a new email address instead of updating their existing one.
- When a user wants to consolidate multiple accounts used for different purposes (e.g., personal, business, or testing) into a single account.
Merging non-staff users
Administrators can merge non-staff users directly through the Discourse UI.
This action is irreversible. The source user account will be deleted after the merge.
To merge two non-staff users:
- Navigate to the user admin page of the source user (the account you want to merge from).
- Scroll to the bottom of the page.
- Click the “Merge” button.
- In the popup window, enter the username of the target account (the account you want to merge into).
- Click the “Transfer and Delete” button to initiate the merge.
Merging large accounts can be resource-intensive and may take some time to process, depending on the amount of data associated with the source user.
What gets merged?
When merging user accounts, Discourse combines data from 45 tables, including:
- Posts and topics
- Likes given and received
- Private messages
- User profile information
- User preferences and settings
- User actions and activity (e.g., bookmarks, topic views)
- Badges and achievements
- Trust level and group memberships
In case of conflicts, the target user’s details are kept. If both users had an anonymous user associated with their account, the one owned by the source user will be lost.
Incoming links referencing the source user (e.g.,
https://discourse.example.com/t/some-topic/17/3?u=source_username
) won’t be associated with the target user after merging.
Important note about merging users and SSO
Merging user accounts can potentially impact SSO, depending on the implementation:
- If SSO is based on email address, there should be no issues as long as the target account’s email is used in the SSO system.
- If the SSO system uses a unique user ID different from the Discourse user ID, merging could cause issues if the source account’s unique ID is not correctly mapped to the target account.
Merging staff users
For security reasons, merging staff users must be done via the console.
If your site is hosted with Discourse, contact team@discourse.org for assistance with merging staff users.
To merge staff users via the console:
- Access the rails console for your site.
- Execute the following command:
rake users:merge['source_username','target_username']
Ensure there are no spaces before or after the comma in the command.
FAQs
Q: What happens if the merge process seems to stall?
A: If the merge progress screen shows no change for an extended period, try refreshing the page. The merge may have completed, but the UI didn’t update.
Q: Can I undo a user merge?
A: No, once two users are merged, the action cannot be undone. The source user account is permanently deleted after the merge.
Q: Will merging users affect their posts and topics?
A: All posts and topics from the source user will be transferred to the target user. The authorship of these items will change to reflect the target user as the creator.
Last edited by @hugh 2024-07-09T03:47:10Z
Last checked by @hugh 2024-07-09T03:47:16Z
Check document
Perform check on document: