(adsbygoogle = window.adsbygoogle || []).push({});
So you've probably all seen NGU's version of renaming a user's username command in their shoutbox right? I mean who hasn't? So i took the time to make one myself for the Inferno shoutbox by x iJB x which is what NGU's shoutbox is based from. Anyway you can see the coding below, follow the instructions on how to use it etc.
.
if(preg_match("#^(/rename\s+)(.*?[^;]);(.+?)$#i", $message, $matches) && $this->can_do_admin())
{
$user = htmlspecialchars_uni(addslashes(trim($matches[2])));
$selectuser = $this->vbulletin->db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE username='$user'");
$checkuser = $this->vbulletin->db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE username='$matches[3]'");
if($selectuser && !$checkuser)
{
$this->me = 1;
$this->vbulletin->db->query("UPDATE " . TABLE_PREFIX . "user SET username='$matches[3]' WHERE username='$user'");
$message = ' has changed the user '.$user.'\'s username to '.$matches[3].'.';
}
else
{
$this->private = $this->vbulletin->userinfo['userid'];
$message = 'The username you have entered is invalid or already taken.';
}
}
How To Use:
Go to your vBulletin root files and enter the 'inferno' directory then the 'shoutbox' directory.
Enter the 'engine' directory and open the 'inferno_shout.php' file.
In the file find the line of code, 'function is_action_code(&$message)' should be on line 188 approximately.
Now place the coding inside that function.
Go to your website and go to your shoutbox.
In your shoutbox to change a user's username type '/rename username;newname' (remember to remove the single quotes and change the 'username' and 'newname' texts to what ever you like.
Credits:
x iJB x for the shoutbox itself =D
NOTE:
You must have You must login or register to view this content. installed to use this function unless you manipulate it in a way to work for other shoutbox's
.
There are a few SQL Injection Vulnerabilities that you will want to fix if you decide to use this script, one of them being in this line, $this->vbulletin->db->query("UPDATE " . TABLE_PREFIX . "user SET username='$matches[3]' WHERE username='$user'");.
However if requested many times i will release my personal version with SQL Injection Vulnerabilities patched
.