Extension talk:Deleteuser

Unable to find

edit

The code to download it seems to be missing. Where can I find it? LinuxSneaker 17:46, 27 October 2006 (UTC)Reply

I cant find it too. Author, can you please put the PHP files in a zip file? Then it will work. Thanks.--Kenny5 00:17, 3 November 2006 (UTC)Reply
Done. Nikn 15:51, 3 November 2006 (UTC)Reply

I found this on a site, has the PHP files... Not sure what happened with the article http://www.wikihumor.ovh.org/Deleteuser.zip


There seems to be an issue with one of the files, it's acting like there is a syntax error in one of them after I add the file to local settings. I added this to LocalSettings.php:

  • require_once("$IP/extensions/Deleteuser/SpecialDeleteuser.php");

(I added the $IP, thinking that was it.) Thanks Jerry.Lees


Hi! Where can i found the file ExtensionFunctions.php. it is not included in the mediawiki 1.8.2 and not included in Deleteuser.zip. every plugin i tested used the unix-way (/) of directory adressing. Not everyone (inclusive me) can work on a Linux-Workstation. Thanks Hchris

ExtensionFunctions.php / Adding Special Page

edit

Hi, im using 1.6.8. but i think this applies to 1.8 also. The idea to have a user deletion system is great. However, in the current version, the special page registration seems all wrong which makes the extension faulty. It does not work in my version and I gather from the comments above that it does not work in other versions either.
I think first of all maybe you should consider placing the files into the INCLUDES directory rather than the EXTENSION directory of the wiki;
then - I am not an expert on this - but it seems to me that following function included in the main extension php file may have to be altered to read something like this:

function wfSpecialDeleteuser() {
        require_once('SpecialPage.php'); #possibly $IP/includes/SpecialPage.php if not set as default path 
        # Add messages
        global $wgMessageCache ;
        global $wgMessageCache, $wgDeleteuserMessages;
	foreach( $wgDeleteuserMessages as $key => $value ) {
		$wgMessageCache->addMessages( $wgDeleteuserMessages[$key], $key );
        }
        class XYZ extends SpecialPage
       {...} # here the class will have to be defined
SpecialPage::addPage ( new SpecialPage_DeleteUser() ) ; #possibly 'sysop' as restriction?
}

May someone with more knowledge please comment or help in this matter. Thank you.

I'd really love to have this developed more if anyone knowledgeable enough would like to help! Can we get this on SVN? --64.22.206.248 00:29, 20 November 2006 (UTC)Reply

Very buggy interface, log messages screwed up and the main point is that this doesn't work. I tried deleting an user, the message on Special:Deleteuser was <deleteusersuccess>, but the user was still on the user list. --Sayuri 14:32, 9 May 2007 (UTC)Reply

It works with 1.9.3 after you make the $uid to $this->$uid change described on the extension page. -- Christian 12:10, 30 May 2007 (UTC)

SpecialDeleteuser.php / Adding Special Page

edit

I'm using Mediawiki 1.9.3 and have made some modification's, so that it works. (User: Gerhard)

1) Save all files in the "/extensions/Deleteuser/" folder.

2) Patch the SpecialDeletuser.php with the following syntax:


 
 $wgAvailableRights[] = 'deleteuser';
 $wgGroupPermissions['bureaucrat']['deleteuser'] = true;

 $wgExtensionFunctions[] = 'wfSpecialDeleteuser';
 $wgExtensionCredits['specialpage'][] = array(
	'name' => 'Deleteuser',
	'author' => 'Nikn',
	'url' => 'http://www.mediawiki.org/wiki/Deleteuser'
 );

 # Internationalisation file
 require_once( 'SpecialDeleteuser.i18n.php' );

 # Add a new log type
 global $wgLogTypes, $wgLogNames, $wgLogHeaders, $wgLogActions;
 $wgLogTypes[]                          = 'deleteuser';
 $wgLogNames['deleteuser']              = 'deleteuserlogpage';
 $wgLogHeaders['deleteuser']            = 'deleteuserlogpagetext';
 $wgLogActions['deleteuser/deleteuser'] = 'deleteuserlogentry';

 function wfSpecialDeleteuser() 
 {
	# Add messages
	global $wgMessageCache, $wgDeleteuserMessages;
	foreach( $wgDeleteuserMessages as $key => $value ) {
		$wgMessageCache->addMessages( $wgDeleteuserMessages[$key], $key );
	}
	
	global $wgOut;
	global $wgParser;
	require_once( "./includes/SpecialPage.php" );
	require_once( "extensions/Deleteuser/SpecialDeleteuser_body.php" );
	SpecialPage::addPage( new Deleteuser() );
 } 

3) Modify also the SQL Syntax in the SpecialDeleteuser_body.php (line 118, 119)

$dbw->delete( 'user', array ( 'user_id' => $this->uid ), $fname );
$dbw->delete( 'user_groups', array ( 'ug_user' => $this->uid ), $fname );

4) Change the message array $wgDeleteuserMessages = array();

located in the SpecialDeleteuser.i18n.php

Another Option

edit

If you simply delete the user details from user and user_groups it will leave mentions of the users in other tables that may expect the entries to still exist in the user table.

What you could do is to create a (or rename an existing) user as 'Deleted User' and then point all the changes, updates etc at this user.

In the following example the user to delete has user_id of 30 and the 'Deleted User' has a user_id of 40.

UPDATE recentchanges SET rc_user = 40,rc_user_text = 'Deleted User' WHERE rc_user = 30;
UPDATE revision SET rev_user = 40,rev_user_text = 'Deleted User' WHERE rev_user = 30;
UPDATE image SET img_user = 40,img_user_text = 'Deleted User' WHERE img_user = 30;
UPDATE oldimage SET oi_user = 40,oi_user_text = 'Deleted User' WHERE oi_user = 30;
UPDATE logging SET log_user = 40,log_user_text = 'Deleted User' WHERE log_user = 30;

UPDATE archive SET ar_user = 40,ar_user_text = 'Deleted User' WHERE ar_user = 30;
UPDATE filearchive SET fa_user = 40,fa_user_text = 'Deleted User' WHERE fa_user = 30;

You should now be able to delete the user.

DELETE FROM user_groups WHERE ug_user = 30;
DELETE FROM watchlist WHERE wl_user = 30;
DELETE FROM user WHERE user_id = 30;

Before you do any of the above make sure you understand what you are doing. Understanding http://upload.wikimedia.org/wikipedia/commons/4/41/Mediawiki-database-schema.png would be a good start.

Iain.

There's also Extension:User Merge and Delete which is easier for people who don't know. It does quite the same.
Return to "Deleteuser" page.