Version: 1.00, by Paul
Developer Last Online: Nov 2023
Version: 2.2.x
Rating:
Released: 08-10-2002
Last Update: Never
Installs: 10
No support by the author.
Hi,
It aggrevates me that this feature isn't a part of vBulletin, so I've gone and added it myself. Let me know on this thread if you have any problems with it. This hack will allow you to change the username value for any posts made by a guest on your forum. If you don't allow guests to post, don't bother with this hack.
I don't have the time to create a screenshot, so you'll have to use some imagination (unless someone else would like to provide one). Just imagine a Username: input box when a moderator with editpost permissions edits a post made by a guest. This will not appear otherwise.
Files to be edited: 1
Template addition: 1
In editpost.php:
Find:
PHP Code:
$foruminfo=getforuminfo($threadinfo[forumid]);
ABOVE it, insert:
PHP Code:
// Edit username on post hack
if (ismoderator ($threadinfo["forumid"],"caneditposts") && $postinfo[userid]==0) {
if (!$username) {
$postusername = $postinfo["username"];
$postusername = htmlspecialchars($postusername);
eval("\$editusername = \"".gettemplate("editpost_editusername")."\";");
} else {
$postusername = "";
}
}
// End edit username on post hack
Find:
PHP Code:
if ($HTTP_POST_VARS['action']=="updatepost") {
BELOW it, insert:
PHP Code:
// Edit username of post hack
if ($postinfo[userid]==0) {
$username = trim($username);
$username = eregi_replace("( ){2,}", " ", $username);
if (!$username) {
eval("standarderror(\"".gettemplate("error_nousername")."\");");
}
if ($userinfo=$DB_site->query_first("
SELECT user.*,userfield.*
FROM user,userfield
WHERE (username='".addslashes(htmlspecialchars($username))."' OR
username='".addslashes(eregi_replace("[^A-Za-z0-9]","",$username))."') AND
user.userid=userfield.userid")) {
eval("standarderror(\"".gettemplate("error_usernametaken")."\");");
} else {
$postusername = htmlspecialchars($username);
}
}
// End edit username of post hack
Find:
PHP Code:
$DB_site->query("UPDATE thread SET title='".addslashes(htmlspecialchars($title))."', iconid=".intval($iconid)." WHERE threadid=$threadinfo[threadid]");
//$title="";
}
BELOW it, insert:
PHP Code:
// Start edit username of post hack
if ($isfirst and $postinfo[userid]==0 and $postinfo[username]!=$postusername) {
$DB_site->query("UPDATE thread SET postusername='".addslashes($postusername)."' WHERE threadid=$threadinfo[threadid]");
}
// End edit username of post hack
Find:
PHP Code:
$DB_site->query("UPDATE post SET title='".addslashes(htmlspecialchars($title))."',pagetext='".addslashes($message)."',allowsmilie='$allowsmilie',showsignature='$signature',iconid='$iconid'$editedbysql$attachmentsql WHERE postid='$postid'");
BELOW it, insert:
PHP Code:
// Start edit username of post hack
if ($postinfo[userid]==0 && $postinfo[username]!=$postusername) {
$DB_site->query("UPDATE post SET username='".addslashes($postusername)."' WHERE postid='$postid'");
}
// End edit username of post hack
Add a template called "editpost_editusername"
Paste the following into the new template and save it (remember to take out the spaces in { firstaltcolor }: