Extension talk:UserMerge

About this board

It is preferred that you open a regular bug report under the MediaWiki-extensions-UserMerge product for new issues.

AlPaD (talkcontribs)

Hello! Could you tell me "$wgGroupPermissions['bureaucrat']['usermerge'] = true;" which folder and where in the folder should I put it? Thanks!

Ciencia Al Poder (talkcontribs)
Reply to "Help to install"

References from Version History not converted

NoHTTP (talkcontribs)

Tried this Plugin on a user A and B in mediawiki 1.37.4

It said that the users A was merged successfully to B, but in the history of a random-picked sample page the edits still were listed as user A.

I repeated the drill and selected "Delete old user". After that the edit-logs of user "A" were all gone. The edit history had only records for other users.

My expectation would be, that edits from user "A" are beeing listed as from user "B" after the merge.

Reply to "References from Version History not converted"
Summary by Seb35

False alert: someone flagged this extension as incompatible with 1.38, but either it was a small issue either it is solved since 3 July: it works with 1.38 and current master (1.39.0-alpha). (talkcontribs)

What happens if you install this extension on MediaWiki 1.38 or 1.39?

FreedomFighterSparrow (talkcontribs)

I'm not sure if it doesn't work - an anon IP added the original note about MW 1.38 incompatibility, and I don't see any open issues regarding it. (talkcontribs)

Should I consider this extension unmaintained?

FreedomFighterSparrow (talkcontribs)

It looks like it received updates as late as Jun 19th, and it's in use by some prominent releases, such as BlueSpice. I'm not sure if there's an official active maintainer.

I think you should just try it on a later version.

Seb35 (talkcontribs)

I and Kghbln reverted the warning given I just tested with MW 1.38 and 1.39 and it works. Perhaps phabricator:T281821 was an issue a few months ago, but it is solved.

If you have specific issues with the extension, please open a task on Phabricator and describe the issue. Be sure you use the lastest version of the extension in the branch REL1_38 (Git method), or you recently downloaded the latest version (branch 1.38) of the extension on Special:ExtensionDistributor/UserMerge.

HackForLive (talkcontribs)

I would like to contribute with multiple user merge scripts. The motivation behind this approach is to merge a list of users without manually entering each user on Special:UserMerge page.

I spin up mediawiki using vagrant. It was running on localhost with administrator credentials (admin:vagrant). I created manually Testold, Testnew and Testold2,Testnew2 users. As a result Testold user should be merged to Testnew and Testold2 shoudl be merged to Testnew2.

Following steps are implemented in provided scripts:

  1. Retrieve login token via mediawiki API
  2. Logon as admin (or someone with usermerge privileges) using login token
  3. Retrieve csfr token via mediawiki API
  4. Loop over users to be merged and for each send post request using csfr token

Tested on Mediawiki version 1.31.x and 1.39.x ‎


$baseUrl = 'http://localhost:8080'
$resp = invoke-webrequest -method GET -uri "
${baseUrl}/w/api.php?action=query&meta=tokens&format=json&type=login" -ContentType "application/json" -SessionVariable session
$loginToken = ($resp.Content | ConvertFrom-Json).query.tokens.logintoken

$body = @{
   "action" = "clientlogin"
   "logintoken" = "${loginToken}"
   "username" = "admin"
   "password" = "vagrant"

$resp = Invoke-WebRequest -Method POST -Uri "${baseUrl}/w/api.php?action=clientlogin&loginreturnurl=${baseUrl}/&format=json" -Body $body -WebSession $session
Write-Host ($resp.Content)

$resp = invoke-webrequest -method GET -uri "${baseUrl}/w/api.php?action=query&meta=tokens&format=json" -ContentType "application/json" -WebSession $session
$csfrToken = ($resp.Content | ConvertFrom-Json).query.tokens.csrftoken

$users = @(
        olduser = 'Testold'
        newuser = 'Testnew'
        # Testold will not be deleted
		deleteOldUser = 0
        olduser = 'Testold2'
        newuser = 'Testnew2'
		# Testold2 will be deleted
        deleteOldUser = 1

foreach($user in $users){
    $body = @{

    $resp = invoke-webrequest -method Post -uri "${baseUrl}/wiki/Special:UserMerge" -Body $body -WebSession $session
    Write-Host ($resp.ParsedHtml.getElementsByTagName('p') | select -Property innerHtml)




    MediaWiki UserMerge Code Sample

import requests
from urllib.parse import urljoin
from bs4 import BeautifulSoup

def client_login(url, login_token, username, password):
    """ Send a post request along with login token, user information
    and return URL to the API to log in on a wiki """

    response = S.post(url=urljoin(url, 'w/api.php'), data={
        'action': "clientlogin",
        'username': username,
        'password': password,
        'loginreturnurl': url,
        'logintoken': login_token,
        'format': "json"

    return response.json()

def fetch_login_token(url):
    """ Fetch login token via `tokens` module """

    response = S.get(
        url=urljoin(url, 'w/api.php'),
            'action': "query",
            'meta': "tokens",
            'type': "login",
            'format': "json"})
    data = response.json()
    return data['query']['tokens']['logintoken']

def fetch_csfr_token(url):
    """ Fetch csfr token via `tokens` module """

    response = S.get(
        url=urljoin(url, 'w/api.php'),
            'action': "query",
            'meta': "tokens",
            'format': "json"})
    data = response.json()
    return data['query']['tokens']['csrftoken']

def user_merge(url, users, csfr_token):
    """ User merge action """
    for user in users:
        response = S.post(
            url=urljoin(url, 'wiki/Special:UserMerge'),
                "wpolduser": user["oldUser"],
                "wpnewuser": user["newUser"],
                "wpdelete": user["deleteOldUser"],
                "wpEditToken": csfr_token,
                "title": "Special:UserMerge",
                "redirectparams": ""
        soup = BeautifulSoup(response.text, 'lxml')

if __name__ == "__main__":
    S = requests.Session()
    URL = "http://localhost:8080"
    login_token = fetch_login_token(URL)
    print(client_login(URL, login_token, 'admin', 'vagrant'))
    csfr_token = fetch_csfr_token(URL)
    users = [{'oldUser':'Testold', 'newUser':'Testnew', 'deleteOldUser': 0},
             {'oldUser':'Testold2', 'newUser':'Testnew2', 'deleteOldUser': 1}]
    user_merge(URL, users, csfr_token)
Reply to "User mass merge"

UserMerge CannotCreateActorException

Summary by Kghbln

See also the respective mailing list thread

Silkwood (talkcontribs)

My config:

Product Version
MediaWiki 1.33.1 (d35fba2)

15:11, December 17, 2019

PHP 7.2.17-0ubuntu0.18.04.1 (apache2handler)
MariaDB 10.1.38-MariaDB-0ubuntu0.18.04.1
UserMerge 1.10.1 (4b7feed) 08:17, July 24, 2019

trying to delete a user (merging it to Anonymous) I get this error and the following backtrace:

UserMerge CannotCreateActorException from line 2516 of /var/www/w/includes/user/User.php: Cannot create an actor for a usable name that is not an existing user.


#0 /var/www/w/extensions/UserMerge/includes/MergeUser.php(378): User->getActorId(Wikimedia\Rdbms\DatabaseMysqli)

#1 /var/www/w/extensions/UserMerge/includes/MergeUser.php(50): MergeUser->mergeDatabaseTables(string)

#2 /var/www/w/extensions/UserMerge/includes/SpecialUserMerge.php(135): MergeUser->merge(User, string)

#3 /var/www/w/includes/htmlform/HTMLForm.php(660): SpecialUserMerge->onSubmit(array, OOUIHTMLForm)

#4 /var/www/w/includes/htmlform/HTMLForm.php(552): HTMLForm->trySubmit()

#5 /var/www/w/includes/htmlform/HTMLForm.php(567): HTMLForm->tryAuthorizedSubmit()

#6 /var/www/w/includes/specialpage/FormSpecialPage.php(184): HTMLForm->show()

#7 /var/www/w/includes/specialpage/SpecialPage.php(569): FormSpecialPage->execute(NULL)

#8 /var/www/w/includes/specialpage/SpecialPageFactory.php(558): SpecialPage->run(NULL)

#9 /var/www/w/includes/MediaWiki.php(288): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)

#10 /var/www/w/includes/MediaWiki.php(865): MediaWiki->performRequest()

#11 /var/www/w/includes/MediaWiki.php(515): MediaWiki->main()

#12 /var/www/w/index.php(42): MediaWiki->run()

#13 {main}

Silkwood (talkcontribs)


It was enough to add the following line in LocalSettings.php

// Add just one user name to the default array

$wgReservedUsernames[] = 'Anonymous';

to get this:

Merge from Giada (691) to Anonymous (0) is complete.

Giada (691) has been deleted.

Thanks to Brian Wolff

Merging IP contributions to an user

Tinker Bell (talkcontribs)

Well, that. It's possible to merge the contributions of an IP to an existing account?

Crochet.david (talkcontribs)

no, an IP contribution can be by anybody, even if your have an IPV6 or a static IPv4.

Reply to "Merging IP contributions to an user"

Could this work with version 1.25?

Bmrberlin (talkcontribs)
Zer00CooL (talkcontribs)

I have test UserMerge and work fine with mediawiki 1.32.0

Bmrberlin (talkcontribs)

Thank you, but I asked for version 1.25.@Bmrberlin

Reply to "Could this work with version 1.25?"

How i can purge the content from Spécial:Journal/usermerge

Zer00CooL (talkcontribs)

I would not want to display the actions performed.

- Either hide them from the public

- Or, preferably, be able to delete them by myself.

How to do ?

Can I empty such information from the database?

Where are the information stored?

The Merge and Delete User information is always displayed from Spécial:Journal/usermerge

The same from Spécial:Modifications_récentes

Ciencia Al Poder (talkcontribs)

You can suppress the contents of those logs (the log will be there, but the information not visible to others) if you have the deletelogentry permission (see Manual:User_rights#List_of_permissions)

Ciencia Al Poder (talkcontribs)

A better approach is to add that log to Manual:$wgFilterLogTypes, which would hide them from Special:RecentChanges and Special:Log (unless specifically requested to be shown).

If you don't want them to be visible even when explicitly requested, add it to Manual:$wgLogRestrictions.

Zer00CooL (talkcontribs)

I do not know either of them. I watch.

We do not hesitate to complete here a little information.

To be able to manage the deletion, or, to hide the logs totally, would be a plus for this UserMerge extension.

Thank you for participating in the discussion so quickly.

I had already tested Logrestriction but I was not able to get what I wanted, to properly hide UserMerge logs, to non-connected users and to single users.

Test 1 # KO

An intermediate solution would be to disable the extension once the merges and deletions have been made.

If the extension is disabled, "log-name-usermerge" is displayed instead of "User Account Merge Log".

A single line will then be displayed in the last changes since Mediawiki: "18:25 (⧼log-name-usermerge⧽). [Zer00CooL (46 ×)]"

Even so, the pages I post on another site with an RSS feed continue to serve the information, a line for each profile that has been merge and deleted.

Disabling the extension is therefore useless. I leave the extension enabled.

Test 2 # KO

# Do not display the UserMerge logs.

$ wgLogRestrictions = ['usermerge' => 'bureaucrat'];

# Bug 1

# Works in part since Special: Journal

The logs are not displayed.

The logs are not displayed either with my connected bureaucrat user.

# Bug 2

# Error from Special page: Journal / usermerge

You can not ⧼action-bureaucrat⧽, for the following reason:

You do not have sufficient rights to perform the requested action.

Test 3 # KO

Another alternative would be to use Lockdown but still it does not seem to work.

I am not on options to indicate, I try "usermerge" to forbid to "user" but the users always have access to the information of journaling, in particular, on "Latest modifications".

I found how to hide all the "last changes" but this is not the purpose of hiding all the changes, only the merge and deletion of user account.


I may not use the right configurations, I do not know how to move on now.



I would then search the database for "deleted the user account" or "log-name-usermerge" or "usermerge".

See if it is possible to delete these kind of entries directly from the database.

# I think it would have been better to use the CleanMediawiki.sh script to delete users. I did not test it. https://github.com/ZerooCool/cleanmediawiki

My research in French on UserMerge :


Zer00CooL (talkcontribs)

OK with this adds to the LocalSettings.php

$wgGroupPermissions['sysop']['deletelogentry'] = true;

$wgGroupPermissions['sysop']['deleterevision'] = true;


The RevisionDelete extension allowed me to replace the UserMerge logging information with neutral information. I would have preferred to delete UserMerge's logging information but the RevisionDelete extension still looks interesting. The history is preserved. The irrelevant information is neutralized.


I guess I can rely on the CleanMediawiki.sh script to learn more about how to clean mediawiki by going through this script.

Nevertheless, the issue remains open if anyone can explain to me with an example adapted to UserMerge, how to delete ALL the logging data of UserMerge.

Reply to "How i can purge the content from Spécial:Journal/usermerge"

How do you actually delete users

Jamiehutber (talkcontribs)

I have tried and tried using:

`%login%, AAHWayne00562260`



But both result in the same error as seen in the error

My problem is that I have some 27k fake user accounts, so I opted for the comma seperated, this doens't appear to work.

So how can I delete all 27k banned users?

Zer00CooL (talkcontribs)

Add a captchap to slow down spam


You can read this to clean mediawiki spam


Look to delete inactif user too


You can look this




Zer00CooL (talkcontribs)

You can test, and, confirm, the best is Cleanmediawiki ut, it's not a officiel repo. Why ? I don't know.

Zer00CooL (talkcontribs)

I have test UserMerge and work fine with mediawiki 1.32.0

I can only delete one user at a time, return to the merge form to delete a second user, return to the form, and so on ...

It's a good tool, but slow, if you have multiple users to delete.

Reply to "How do you actually delete users"

Error: 42P01 ERROR: relation "ignore" does not exist

1 (talkcontribs)

Hi, i've Postgress

Reply to "Error: 42P01 ERROR: relation "ignore" does not exist"