[Mediawiki-l] Delete user account

Richards,Michael Michael.Richards at gartner.com
Mon Oct 4 20:11:15 UTC 2004


Chuck,

First, find the user_id for the account you wish to delete e.g.
   select user_id from user where user_name = 'old_user_name';

Assuming they have no contributions, you can just delete the user record. e.g.
   delete from user where user_name = 'old_user_name';

However, if the reason you are deleting is because you have two user accounts for the same person, and the old user account has already been used to make edits, and you want to merge the two accounts, you also need to fix several other tables to point to the new username e.g. lets say the old user_id is 66, and the new user_id is 99:
  update old           set old_user_text = 'old_user_name' where old_user = 66;
  update cur           set cur_user_text = 'old_user_name' where cur_user = 66;
  update recentchanges set rc_user_text  = 'old_user_name' where rc_user  = 66;
  update archive       set ar_user_text  = 'old_user_name' where ar_user  = 66;
  update image         set img_user_text = 'old_user_name' where img_user = 66;
  update old           set old_user      = 99              where old_user = 66;
  update cur           set cur_user      = 99              where cur_user = 66;
  update recentchanges set rc_user       = 99              where rc_user  = 66;
  update archive       set ar_user       = 99              where ar_user  = 66;
  update image         set img_user      = 99              where img_user = 66;

Note that the user_id and user_name fields are duplicated in each of these five tables (for performance reasons).

There may be a script to do all this that I am unaware of. If so can someone please mention it.

If you just want to change the user name, then just update the user_name on the user table and the user_text on the other five tables. Again, there may be a script for this.

Michael Richards

-----Original Message-----
From: mediawiki-l-bounces at Wikimedia.org
[mailto:mediawiki-l-bounces at Wikimedia.org]On Behalf Of Chuck Bishop
Sent: Monday, October 04, 2004 3:30 PM
To: mediawiki-l at Wikimedia.org
Subject: [Mediawiki-l] Delete user account


Is there a way to delete a user login account?

Thanks,

Chuck



More information about the MediaWiki-l mailing list