User:Ilya/OpenWetWare/User management

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

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);
 * /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:

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

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 duplicate accounts (diff user IDs with the same email address):

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

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)


 * How do I delete a user from my list of users?

mysql> DELETE from user WHERE user_name='The Username';
 * SQL query from http://nasa.iu.hio.no/wiki/index.php/MetaWiki

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";
 * http://mail.wikipedia.org/pipermail/mediawiki-l/2005-May/004953.html


 * How to update all the references to the user ID: http://mail.wikipedia.org/pipermail/mediawiki-l/2005-May/005282.html

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 
 *  : e.g., openwetware
 *  : Name of the user to assign edits from
 *  : Name of the user to assign edits to
 * delete old user (see above) and the User:olduser page

Miscellaneous

 * OpenID and account management on subwikis (from Austin):
 * I've eliminated all but login via openwetware on subwiki. See http://test.private.openwetware.org/
 * For account management, see http://test.private.openwetware.org/wiki/Special:OWWadmin
 * Bulk account creation:
 * How do I add multiple user accounts?
 * ImportUser extension imports users from a CSV file
 * Tables that contain user ID field:
 * user:user_id (PK)
 * user_newtalk:user_id (FK)
 * user_groups:ug_user (FK)
 * watchlist:wl_user (FK)
 * revision:rev_user (FK)
 * recentchanges:rc_user (FK)
 * image:img_user (FK)
 * oldimage:oi_user (FK)
 * filearchive:fa_user
 * logging:log_user (FK)
 * ipblocks:ipb_by (FK)