# User:Ilya/OpenWetWare/User management

## Database tricks

• To give "developer" access to the user (also, there is a user_groups table):
UPDATE user_rights SET ur_rights="sysop,bureaucrat,developer" WHERE ur_user=3;

• /data/web/admin/update_userstats.sql will update the user stat count to match the real number. Currently it'll have to be run manually:
update site_stats set ss_users=(select max(user_id) as total from user);


or

update site_stats set ss_users=(select count(*) from user);

• To find all edits made by a user ID:
select page_title from page,revision where page_id = rev_page and rev_user = ;

• To find duplicate accounts (diff user IDs with the same email address):
select distinct a.user_id,a.user_name,a.user_real_name,a.user_email
from user a, user b
where a.user_email = b.user_email
and a.user_id != b.user_id
and a.user_email !=
order by a.user_email;

• To find the real number of users (subtract duplicates as defined above but include blank emails) - does not work yet
select distinct a.user_id
from user a, user b
where a.user_email != b.user_email
and a.user_id = b.user_id;


## Deleting user

• Should be done only if a user doesn't have any contributions yet (otherwise this would destroy referential integrity in the DB); this can be easily checked (change Username in the URL to the username of interest)
mysql> DELETE from user WHERE user_name='The Username';


If I actually remove a user account it's one that's 100% been used for malicious purposes, so I want to get rid of any traces of the existence, including in the recentchanges table which is easy by something like

delete from recentchanges where rc_user_text = "YoGa";


## Renaming user

• But can I rename the user, then?
• Renaming Mediawiki Users in 1.5
• Extension can be used by bureaucrats from ver 1.5:
• Manually:
• create a new user
• run reassignEdits.sh
reassignEdits.sh <wikiname> <from> <to>
<wikiname> : e.g., openwetware
<from> : Name of the user to assign edits from
<to> : Name of the user to assign edits to
• delete old user (see above) and the User:olduser page