posted by Dave_L:
Could someone review the code in version 2.01 of the Change Username hack?
It's been sitting there for almost a month, and it needs another pair of eyes to determine whether it's correct. In particular, I'm not sure if too many or too few rows are getting deleted for the old username.
Thanks
There is a bug when merging users.
I had someone create a new user (RoadRunner) and we merged his old user into this one. Well, all his old posts came over just fine, but any posts made under the new user before the merge disappeared. I found that they were still in the db, but the B_PosterId was still listed under the U_Number of the new user before the merge.
Changing the B_PosterId to the old U_Number made his posts reappear again.
Here's the db changes that were necessary:
// new user number, deleted after merge
mysql> select U_Number from w3t_Users where U_Number = '10195';
Empty set (0.00 sec)
mysql> select B_Number,B_Username,B_PosterId from w3t_Posts where B_Number = 4677;
+----------+------------+------------+
| B_Number | B_Username | B_PosterId |
+----------+------------+------------+
| 4677 | RoadRunner | 10195 |
+----------+------------+------------+
1 row in set (0.00 sec)
mysql> select U_Number from w3t_Users where U_Username = 'RoadRunner';
+----------+
| U_Number |
+----------+
| 906 |
+----------+
1 row in set (0.00 sec)
mysql> update w3t_Posts set B_PosterId = '906' where B_PosterId = '10195';
Query OK, 7 rows affected (0.01 sec)
Rows matched: 7 Changed: 7 Warnings: 0
I've updated the sk_dochangename.php script and attached the new archive.
-Lance