PDA

View Full Version : When you change a username, update thread starter (without updating all threads)


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
");

cinq
01-05-2005, 05:14 AM
I thought by default when you change a member's username, it gets updated site-wide ?

Intex
01-05-2005, 09:29 AM
Not to my knowledge, unless I'm missing something. I changed one of my usernames only the other day and I had to update the counters manually.

Nice job sblum. Thanks for sharing.

I thought by default when you change a member's username, it gets updated site-wide ?

manguish
01-05-2005, 09:41 AM
Mine gets updated site wide?

Zachery
01-05-2005, 12:20 PM
This is fixed in 3.0.4 IIRC :)

nexialys
01-05-2005, 12:47 PM
.. this hack have to be reset to be for vB Version: 3.0.3 or prior to... as the 3.0.4 version is already corrected (as said Zach and me.. ;) )

Oblivion Knight
01-05-2005, 01:05 PM
I've installed this since I'm using a patched 3.0.3..

Thanks for sharing! :)