Extension:EditUser 2

What can this extension do?
This extension allows editing of the user's Real Name and Email Address fields, as well as, set a new password.

Usage
This extension was developed and has been tested on MediaWiki 1.6.10 only.

Download instructions
Please cut and paste the code found below and place it in. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation
To install this extension, add the following to LocalSettings.php:

Code
EOT );     } 		}

function showGetUserForm { global $wgScript, $wgOut; $title = htmlspecialchars( $this->getTitle->getPrefixedText ); $action = htmlspecialchars( $wgScript ). "?title=". $title;

$wgOut->addHTML( << 

EOT );		}

function performUserModify { global $wgRequest, $wgOut, $wgScript;

$title = htmlspecialchars( $this->getTitle->getPrefixedText ); $action = htmlspecialchars( $wgScript ). "?title=". $title;

$username = $wgRequest->getText( 'modifyusername' ); $userRealName = $wgRequest->getText( 'realname' ); $userEMail = $wgRequest->getText( 'emailaddr' ); $newpassword = $wgRequest->getText( 'newpassword' ); $passwordconfirm = $wgRequest->getText( 'confirmpassword' );

if ( strlen( $username ) > 0 ) { $user = User::newFromName( $username ); $userID = $user->mId; $user->loadFromDatabase;

if ( !is_object( $user ) || $userID == 0 ) { $validUser = false; $wgOut->addHTML( <<  EditUser Error: Invalid Username    EOT			     ); } else { $validUser = true; }			}

if ($validUser ) { $saveSettings = false; $passwordMismatch = false; if ( strlen( $newpassword ) > 0 ) { if( $newpassword == $passwordconfirm ) { //Passwords match $user->setPassword( $newpassword ); $saveSettings = true; } else { //Passwords DO NOT match $passwordMismatch = true; $wgOut->addHTML( <<   EditUser Error: Passwords do not match    EOT    		     ); } 			}  // end if ( strlen( $newpassword ) > 0 )

if ( $passwordMismatch == false ) { if ( $userRealName != $user->mRealName) { $user->setRealName($userRealName); $saveSettings = true; }         if ( $userEMail !=  $user->mEmail) { $user->setEmail($userEMail); $saveSettings = true; }

if ( isset($_REQUEST['referringpage']) ) { if ( isset($_REQUEST['limit']) && strlen($wgRequest->getText('limit') > 0) ) { $action = htmlspecialchars( $wgScript ). "?title=Special:Listusers"; $action .= "&limit=". $wgRequest->getText( 'limit' ); $action .= "&offset=". $wgRequest->getText( 'offset' ); }else{ $action = htmlspecialchars( $wgScript ). "/Special:Listusers"; $autoRedirect = ''; }         }

if ( $saveSettings ) { $user->saveSettings; $wgOut->addHTML( << $autoRedirect EditUser: Successfully updated {$username}    EOT              ); } else{ $wgOut->addHTML( << $autoRedirect EditUser: No changes were made <P>   <input type="submit" name="submit" value="OK" style="height: 23px; width: 50px" /> EOT              ); } // end if ( $saveSettings ) } // end if ( $passwordMismatch = false ) } // end if ($validUser ) } // end performUserModify function displayRestrictionError { global $wgOut; $wgOut->addHTML( "EditUser Error: You are not authorized to use this function." ); }		 }

SpecialPage::addPage( new EditUserPage ); }