sblum
01-04-2005, 10:00 PM
This is a pretty simple hack. I was annoyed by the fact that when you change somebody's username it doesn't edit the thread starter field to include their new name, and on a large board updating all threads information is a huge pain in the ass.
Open up admincp/user.php
find:
$olduser = strlen($olduserinfo['username']);
$newuser = strlen($user['username']);
$DB_site->query("
UPDATE " . TABLE_PREFIX . "pmtext
SET touserarray = REPLACE(touserarray, 'i:$userid;s:$olduser:\"" . addslashes($olduserinfo['username']) . "\";','i:$userid;s:$newuser:\"" . addslashes($user['username']) . "\";')
");
add right after:
//update thread starter
$DB_site->query("
UPDATE " . TABLE_PREFIX . "thread
SET postusername = '" . addslashes($user['username']) . "'
WHERE postuserid = $userid
");
Open up admincp/user.php
find:
$olduser = strlen($olduserinfo['username']);
$newuser = strlen($user['username']);
$DB_site->query("
UPDATE " . TABLE_PREFIX . "pmtext
SET touserarray = REPLACE(touserarray, 'i:$userid;s:$olduser:\"" . addslashes($olduserinfo['username']) . "\";','i:$userid;s:$newuser:\"" . addslashes($user['username']) . "\";')
");
add right after:
//update thread starter
$DB_site->query("
UPDATE " . TABLE_PREFIX . "thread
SET postusername = '" . addslashes($user['username']) . "'
WHERE postuserid = $userid
");