Previous Thread
Next Thread
Print Thread
Rating: 5
Page 1 of 2 1 2
#217359 05/29/2002 1:14 AM
Joined: Mar 2002
Posts: 305
Enthusiast
Enthusiast
Offline
Joined: Mar 2002
Posts: 305
From this thread
In reply to:

This hacks allows you to:

a) Change a username to something new

b) if the new username already exists, the script will merge the usernames.

All the settings from the old username will be kept - except for the total posts number, which will reflect the correct totals. The title doesn't get reset though, so you may need to modify it manually.

PMs sent and received, address book entries, moderators, subscriptions, read receipts etc etc are all handled and reflect the new username.

I built on Dave's great work - thanks!

Max





I only changed a couple lines to get it to work. I also had to add in a section to change the "last post by" section, because it wasn't changing the name there.
Attachments
48353-changeusername.zip (0 Bytes, 15 downloads)


[:"red"]Lisa[/]
Sponsored Links
Joined: Jan 2001
Posts: 374
Enthusiast
Enthusiast
Offline
Joined: Jan 2001
Posts: 374
Thank you very much. !!!!!

Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
so this doesn't work under 6 final? I just tried it, the link shows up in the admin panel, but when you click it the right page is just a blank white page

Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
Thank you.

Works just fine - will be very useful when I convert a forum from UBB to threads - I have extended it to my moderators, so that the workload of changing usernames is shared.

I realise it is a risk - but then I like to trust people.

Ian.


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Mar 2002
Posts: 305
Enthusiast
Enthusiast
Offline
Joined: Mar 2002
Posts: 305
I'm sorry, it works for me. Are you sure the sk_changename.php file is in your ubbthreads/admin folder? That is the page that should be called up when you click the link.


[:"red"]Lisa[/]
Sponsored Links
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Yes works just fine and so do signatures

Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
sorry for my ignorance, I didn't see Lisa's new attachment, so I was using the old attachment

Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
Works great on 6.0.1 !!

Thanks!

Joined: Feb 2002
Posts: 950
Hacker
Hacker
Offline
Joined: Feb 2002
Posts: 950
6.0.1 worked right out of the box; cant get a hack thats any easier to install!

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Awesome hack. Works great... should be part of the official relase.

Here's a tip:
I had a user "bobbrown" who asked to change his username to "BobBrown" (note the capitols). Using the change for this actually deletes the user...... BUT

There is a work around....
Change "bobbrown" to "bobbrown2".. then change "bobbrown2" to "BobBrown" and it works fine.

Just a tip if anyone has this type of request.

Sponsored Links
Daine #217369 06/21/2002 10:06 PM
Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
Yep, I changed a user's name to have some caps, and they vanished later on. It did change them for a bit...

At least now I know to change them to something else first! LOL

Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
Thanks for reporting that.

Maybe the hack should be revised to either deal with that case, or disallow it.


Joined: Apr 2002
Posts: 56
Power User
Power User
Joined: Apr 2002
Posts: 56
I had that too, changed a guy from barryrs4 to BarryRS4 and he was fine, then a few hours later he completely vanished from the database! his account and all his posts, the guy was really pissed as he had like 1500 posts and went down to newbie status!

Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
Now we need a hack to backup all the deleeted users and their posts! ROFL

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
A hack from the admin menu that did a mysqldump would be a wonderful idea.... saving the last 5 backups or so.

Joined: Dec 2000
Posts: 1,471
Addict
Addict
Offline
Joined: Dec 2000
Posts: 1,471
[]Maybe the hack should be revised to either deal with that case, or disallow it.

I already played with that but didn't complete it.
I simply convert the usernames to lowercase and do a comparison. You can simply skip the db-queries that are used for merging 2 users and cause the disapearing.

I can post the code, when i'm back home. But it isn't finished yet.


Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
So in sk_dochangename.php, if strcasecmp($olduser,$newuser)==0, then you would do all the queries after the comment "go ahead and change the source username to the target username everywhere", but omit all the preceding queries?

I wonder if the eregi_replace() on line 201 should be changed to ereg_replace(). Maybe that doesn't matter.

Joined: Dec 2000
Posts: 1,471
Addict
Addict
Offline
Joined: Dec 2000
Posts: 1,471
I attached my modified version with the workaround for the upper and lower case problem. It should work but isn't fully tested. So you may want to backup your user before trying it. Let me know if any problems occur.

@Dave_L yes, that was the way i did it. Yes, ereg_replace would be better code. Also it doesn't matter here, because the usernames are case insensitive.
Attachments
51097-sk_dochangename_modified.txt (0 Bytes, 51 downloads)

Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
Thanks

A few issues:

1) Are the parameters to authenticate() not necessary? I haven't figured out exactly how that function works.
code:
$user = $userob -> authenticate();



2) strcasecmp() usage:
code:
if strcasecmp($olduser,$newuser)==1 {


should be
code:
if (!strcasecmp($olduser,$newuser)) {



Or maybe your original code is easier to understand. I'm not sure.
code:
if (strtolower($olduser) == strtolower($newuser)) {



3)
code:
$upandlow = true;


should be
code:
$upandlow = 1;



4)
code:
$newmods = addslashes($newmods);


should be
code:
$newmods_q = addslashes($newmods);



I've made some enhancements to my copy of the hack:
a) Expanded explanation of what the hack does in the entry form.
b) Added more safety checks, including those done by adduser.php.

Should I merge my changes into your version and upload that?

Joined: Dec 2000
Posts: 1,471
Addict
Addict
Offline
Joined: Dec 2000
Posts: 1,471
[] Are the parameters to authenticate() not necessary? I haven't figured out exactly how that function works.

Yes, the authentication function has been changed in V6, so all necessary parameters are set by default. Look at ubbt.inc.php for details.

There shouldn't be any difference betweem strcasecmp and strtolower, but i'll choose the first one cause i don't know how strtolower behaves on '"@| etc...

Yes, i missed the "!" before the statement, removed it for testing.

code:
$upandlow = 1; and $upandlow = true;


Both should work, i'm used to set boolean = true/false from java programming.


code:
$newmods_q = addslashes($newmods);


Yep, missed that one, thanx.

[] I've made some enhancements to my copy of the hack:
a) Expanded explanation of what the hack does in the entry form.
b) Added more safety checks, including those done by adduser.php.


Greatly appreciated


Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
Re: authenticate() - thanks, that's what I thought, but wasn't sure.

That's a good point about strtolower() not converting special characters to lower case. Although, I think Rick uses strtolower() in other places for comparing usernames. I wonder if that's a potential problem.

This is PHP, not Java.

I believe in using the idioms for whatever language I'm using. In PHP (and Perl and C), boolean operations are designed to work with 0 for "false" and nonzero for "true". Using "true" and "false" in PHP is a bad practice, because you're fighting the language. For example, both "true" and "false" evaluate as true in boolean context. And if you want to compare two boolean values, it's simpler (and more reliable) if you stick with the language conventions.

But if you're going to use "true" anyway, the quotes should be present. Depending on the PHP version and the error_reporting() level, true (without the quotes) will result in a warning or error message.

I'll post my modified version.

Joined: Dec 2000
Posts: 1,471
Addict
Addict
Offline
Joined: Dec 2000
Posts: 1,471
[] Although, I think Rick uses strtolower() in other places for comparing usernames.

Yep, that's why i used it at first. But as you have mentioned, i'm not really familiar with PHP.
Will stick to to 1 and 0 now

Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
I may have been wrong about the 1/0 and true/false stuff.

I just noticed in the PHP manual that in version 4, there are keywords True and False. I haven't had time to see exactly how they work.

Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
It was pointed out in another post that the w3t_PollData.P_IP column contains a username (or an IP address).

I assume this needs to be added to the script?

Joined: Dec 2000
Posts: 1,471
Addict
Addict
Offline
Joined: Dec 2000
Posts: 1,471
Yes, if you wanna have 100% clean code.
The you also have to change w3t.PollData.P_Name and w3t.Polls.P_Name.
Both contain the combination of the ip and the username who started the poll. The Poll is identified via that fields.

But you can't edit polls anyway so not updating this fields shouldn't cause any problems. Also it's not perfect then...

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Any chance we might see the newer version?


- Allen wavey
- What Drives You?
Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
There's a good chance

I'm in the middle of doing other things, but I haven't forgotten about this.

Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
I'm back to working on this now.

I'm trying to figure out who to list in the History or Credits section. Is the following accurate? If not, please make corrections or additions.

sixpack69 - original author of UBB.threads version 5 hack (5/01)
Dr_Manhattan - reworked hack (11/01)
Max Fisch - reworked hack (2/02)
Lisa_P - adapted hack for version UBB.threads version 6 (5/02)
Astaran - added fix so that hack would work correctly when old and new usernames differ only in alphabetic case. (6/02)

References:
Plug-in: change username
Change Username Hack, reposted
Change Username Hack

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
sounds good... it can always be updated if some obscure person was missed, like the dude that asks questions, me



- Allen wavey
- What Drives You?
Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
[:"red"]CAUTION: THIS HAS NOT BEEN FULLY TESTED[/]

NAME: Change Username
VERSION: 2.0.0
DESCRIPTION: Changes a username, or merges two usernames
WORKING UNDER: UBB.threads 6.0.2
PREREQUISITES: none
AUTHORS: sixpack69, Dr_Manhattan, Max Fisch, Lisa_P, Astaran, Dave_L
CREDITS: documentation adapted from that provided by Max Fisch
DEMO: none
FILES ALTERED: admin/menu.php
DATABASE ALTERED: username changed
NEW FILES: admin/sk_changeuser.php, admin/sk_dochangeuser.php, admin/sk_changeuser.inc.php

HISTORY:
2001-05-04 sixpack69 - Original release (UBB.threads version 5).
2001-07-14 Dr_Manhattan - Reworked.
2001-11-09 Dr_Manhattan - Revised.
2002-02-13 Max Fisch - Modified to include more database conversion.
2002-05-29 Lisa_P - Adapted for UBB.threads version 6.
2002-06-25 Astaran - Added fix so that hack would work correctly when old and new usernames differ only in alphabetic case.
2002-07-06 Dave_L - Expanded displayed information on entry form, and added same checks that are in adduser.php.

REFERENCES:
Plug-in: change username
Change Username Hack, reposted
Change Username Hack

********
ABSTRACT
********

This modification changes a username, or merges two usernames.

Numerous columns in the database get modified, so it is recommended that you back up the database prior to installing or using this hack.

If the new username already exists, the database information (posts, messages, moderators, etc.) associated with both usernames will be merged and associated with the new username. The settings from the old username will be kept, except for the total post count, which will be adjusted to include the total posts from both usernames. The title doesn't get reset, though, so you may need to modify it manually.

The columns w3t_Polls.P_Name and w3t_PollData.P_Name are *not* converted. Since polls cannot be edited, this is not considered to be a problem.
Attachments
51950-changeusername-2-0-0.zip (0 Bytes, 7 downloads)

Joined: May 1999
Posts: 149
Enthusiast
Enthusiast
Offline
Joined: May 1999
Posts: 149
Hi Dave,
I just looked this over... a couple of questions:
* I didn't see the user and post ratings updated... did I miss them, or are they not converted
* I didn't quite get why uppercase gets converted to lowercase - in the old version, you could modify the capitalization of a name. Was this creating problems in some databases?

Cheers,
Max

Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
1) There's nothing in there now to convert the ratings.

It looks like the w3t_Ratings.R_Rater column needs to be converted.

Also, the w3t_Ratings.R_What column needs to be converted if it's a username (w3t_Ratings.R_Type == 'u'), rather than a post number (w3t_Ratings.R_Type == 't').

In addition, w3t_Posts.B_LastEditBy was left out.

Thanks for the feedback. I'll make a note to add these in. Please let me know if you find anything else missing.

2) It should handle case-conversions correctly. That was one thing that I did test. The lowercase/uppercase stuff had to do with a bug in an earlier version - if the old and new names differed only in case, the user got deleted. The earlier posts in this thread discuss that.

Last edited by Dave_L; 07/06/2002 9:50 PM.
Joined: May 1999
Posts: 149
Enthusiast
Enthusiast
Offline
Joined: May 1999
Posts: 149
Got it - thanks!

Case conversions worked fine for me with the old version, I did test for that... my guess is that different database/php installations handled it differently, good to hear it's cleaned up.

Cheers,
Max

Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
Found a small mistake in the documentation. In the installation instructions for admin/menu.php, "Replace with" should be "Insert after".

Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
Found some other columns that need to be converted:

w3t_Online.O_Username
w3t_Favorites.F_Owner
w3t_Banned.B_Username

I noticed these when reading a post on the UBB Central demo board.

Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
I took another look at the poll stuff:

w3t_Polls.P_Name (timestamp concatenated with username)
w3t_Polldata.P_Name (timestamp concatenated with username)
w3t_Polldata.P_IP (username or IP address)

I don't think converting the P_Name columns is important, since that appears just to be a way of uniquely identifying the poll. (And it would be messy to convert.)

But the P_IP column is evidently how the script keeps users from voting more than once, so that probably should be converted.

Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
Dave,

No pressure but... I am about to convert over a 1,000+ member forum to threads, and will rely heavily on this hack over the next 24 hours or so - as many of our users have different usernames to their old UBB screen names.

I guess that these other fields could potentially be quite important - is it worth me holding off until you release another update? Or are these other fields not going to cause me major headaches with half converted data?

Cheers,

Ian


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
I'm attaching an updated version, 2.0.1, which has all the corrections noted above.

I added conversions for the following columns:

w3t_Posts.B_LastEditBy
w3t_Ratings.R_Rater
w3t_Ratings.R_What
w3t_Online.O_Username
w3t_Favorites.F_Owner
w3t_Banned.B_Username
w3t_Polldata.P_IP (username or IP address)

For some of these, I deleted any existing rows for the new username, but I'm not sure whether it's correct to do that.

I would [:"red"]NOT[/] recommend using either the previous version or this new version on a production board until others have reviewed the code and beta-tested it.
Attachments
52326-changeusername-2-0-1.zip (0 Bytes, 11 downloads)

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Ian, if you are importing a ubb.classic into threads, there is a fix for the import script to import users using their public displayed name. It has been posted a few places... infopop a couple of times. If you can't find it and need it, I'll find it for you


- Allen wavey
- What Drives You?
Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
Thanks Allen - but we are going down the login name route - and then altering them.

It is now 05:45 here - and the new forums are live!!! It has been a long night....

Just waiting for the complainst to start now!!

Ian.


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
heheh... good luck


- Allen wavey
- What Drives You?
Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
Thanks - discovered that Moderators are not carried over fully - with 70 forums, it was a lot of PM's that suddenly went out when they were all in place Still we are up and running - now to install a few hacks..... I've also got to add another 150 forums later today or tomorrow!!


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
This is getting off-topic for this thread, but I don't think there's been a correct fix posted for this. I've hacked the import script to do this (among other things, which I'm still working on), and it involves numerous changes.

Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
Not sure if you have covered this one yet - but if you change a username of a moderator it keeps the old username in the $modlist variable under postlist.php

Apologies if it has already been addressed.

Regards,

Ian


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
Hmm, this hack deleted one of my moderators when I went to change their name to have some caps. Then I re-added them to the two forums they are a moderator in since they had been removed when they were accidentaly deleted due to the name change hack bug. Anyways... now I added them back as moderator to two boards, and one of the boards they show up twice at the bottom as a moderator. The other board they are listed only once as they should be. I have removed them as moderator and re-added them to the board, and their name is showing up twice again.

Any ideas how I can get this corrected? I am getting razzed about this fairly regularly from the mod, and I just keep telling her she has to do twice the job! hehe

Maybe this is the same as the post above is mentioning?

Joined: Jan 2002
Posts: 218
Enthusiast
Enthusiast
Offline
Joined: Jan 2002
Posts: 218
To fix that, you will need to actually view the contents of the B_Board table and manually correct the moderators listed for the board. I've had to do this once or twice.

Make absolutely sure that you leave a comma before and after the names of the moderator. For example:

,Moderator A,Moderator B,

SDS #217405 07/12/2002 10:20 PM
Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
How do I do edit this file?

Last edited by Aglavalin; 07/12/2002 10:29 PM.
Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
Are you using version 2.0.1 of the hack?

Could you dump out the moderator info from the database?

SELECT U_Username,U_Status,U_Groups
FROM w3t_Users
WHERE U_Status='Moderator'

SELECT G_Name,G_Id
FROM w3t_Groups
WHERE G_Name='Moderators'

SELECT Mod_Board,Mod_Username
FROM w3t_Moderators

SELECT Bo_Keyword,Bo_Moderators
FROM w3t_Boards

In w3t_Boards.BoModerators, are all the moderator names both preceded and followed by a comma? It should look like: ",mod1,mod2,mod3,". If the comma at the beginning or end of the string is missing, that would explain the problem, because the hack assumes they're present.

If the commas are present, there may be an inconsistency among the above tables.

Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
See my recent reply to canvey.

Do you know how to view/update your MySQL database using phpMyAdmin or with direct MySQL queries?

If not, if you'll show me the results of those SELECT queries, I can tell you how to fix the problem (if you don't have a large number of boards and moderators).

Joined: Jan 2001
Posts: 374
Enthusiast
Enthusiast
Offline
Joined: Jan 2001
Posts: 374
Houston, we have a problem...

Hi, if I put in a wrong user nickname (to generate an error) I get a WARNING on the error page, that the variable CAT could not be read.

Greetings

Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
Do you mean that for the old username, you enter a nonexistent username? What is the exact error message?

Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
Hi Dave,

I have a suggestion for the Change Username hack. If one wants to change a username as an admin one might click on the 'Edit this user' link under showprofile.php. To reduce the chances of changing the wrong old username, especially when two names could be very similar, I would propose to add the change username option to the selectionoption.php screen under admin.

Therefore I have added the following code to admin/selectoption.php

Find

code:
$html -> close_table();

$html -> close_table();
// ----------------
// send the footer
$html -> send_admin_footer();



add just above

code:
// --------------------------------------------------
// Change Username additional mod ICW 13-07-02

if ( ($user['U_Status'] == 'Administrator') && ($Number != '1') ){
echo "
<tr><td class=lighttable valign=top>
<a href="{$config['phpurl']}/admin/sk_changename.php?Cat=$Cat">Change a username</a>
</td><td class=darktable>
Change the username.
</td></tr>
";
}

// --------------------------------------------------
// End of Change Username additional Mod by ICW



Now comes the problem, this works fine to only appear for an admin, and not for a moderator, and also will not show if an admin clicks on the first admin (perhaps that check could be added as default to protect the first admin) - the problem I have is that I cannot pass the username to the sk_changename.php file.

I am guessing that the form neads to be changed to two option fields as in banuser.php - could also the cat bit be added as well so that this is retained in the url.

My problem is that I am starting to get out of my depth so would appreciate some assistance, especially as it will mean me altering the core files.

Also I wondered if we could add in sending a message to both the other admins, and also to the user to inform them off the change - just in case another admin decided to do the dirty

Regards,

Ian


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
Those are good ideas.

Another feature I'd like to have is a confirmation page.

But I really need to get back to some other work, and probably won't have time to make substantial changes to this hack in the near future. Enhancing the user interface wouldn't be difficult, just time-consuming.

At this point, I think the priority should be to have someone else review the hack's code (primarily the database stuff) for correctness.


Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
Sorry.


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
Don't be sorry.

This hack was written by about six people. Maybe it's time for someone else to work on it.

But I'm not sure if the database processing is correct, and I wish someone else (who knows more about this stuff than I do) would take a look at that.

Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
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

Joined: Mar 2002
Posts: 305
Enthusiast
Enthusiast
Offline
Joined: Mar 2002
Posts: 305
Hey Dave

I'm an idiot when it comes to coding, so I'm not much help. I'm curious though, why do you need to use the deletes? Whenever I've changed names manually (meaning through the database) I've been able to do it all just using updates (at least I thought!). Am I missing something? I've always gone back through and done a search for any reference to the old username and I've never found it still showing up (not counting references inside of posts). Have I just been getting lucky?


[:"red"]Lisa[/]
Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
The deletes are necessary if you're merging two different users into a single user. Otherwise, there would be duplicate rows.

Joined: Dec 2000
Posts: 1,471
Addict
Addict
Offline
Joined: Dec 2000
Posts: 1,471
I had a quick look on the code. Looks very advanced.
If i'm read, you always delete the new username, if it already exists, cause you wanna merge them.
I'd prefer to have "merge" as an option (checkbox) cause most of the time, i don't wanna merge users.
I simply don't want to change anything, if the new username already exists. Then the User has to choose another name, he wants to change to.

Hopefully, i can do some testing tomorrow. I'll post my results here, but everything looks fine so far.:)

Joined: Aug 2002
Posts: 1
Lurker
Lurker
Offline
Joined: Aug 2002
Posts: 1
WOW!, I was hoping to get some help with changing a registar'd users ID as he used an email address for his ID.

I have to admit, I'm lost. I have no idea what and how to even attempt this so I'm afraid to even try this.

I have about 180,000 page views the last month, and this is the first time for me to ever do this. I'm not exactly dumb, but I'd consider myself a little ignorant when trying to understand what you all have been talking about.

Point is, when the smoke is clear, have any of you got a safe way to change a current users name with the newest 6.?? version ubb board. I just set this up in may of this year and I'm scared as He$$ to modify this thing as I have so many that are on here and I'm not wanting to have problems doing a little simple thing I'd thought would have been incorporated.

Any suggests or ideas that might get me in the right direction would really be appreciated.

Here is my email address just in case I can't find this again. [][email protected][/]
http://theoildrop.server101.com/cgi/ultimatebb.cgi


Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
This is a pretty simple hack to install.

Just make sure to backup all changed files and your database so you can restore your board and posts to original condition if things go bad for you. Also, make sure you close your board first to help make things go as smoothly as possible.

Joined: Aug 2002
Posts: 3
Lurker
Lurker
Offline
Joined: Aug 2002
Posts: 3
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
Attachments
54512-changeusername-2-0-2.zip (0 Bytes, 8 downloads)

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Thanks Lance

I have a question about an earlier version I used. I changed a member's name (merged his old acct with the new so he could use his old public displayed name from ubb.classic) and it worked fine. But now his signature doesn't appear under his posts (double-checked a few times that it is actually there), his rating isn't showing, nor is his avatar.

Is there some kind of update command I can run in phpmyadmin to clear it up and allow those to show?


- Allen wavey
- What Drives You?
Joined: Aug 2002
Posts: 3
Lurker
Lurker
Offline
Joined: Aug 2002
Posts: 3
Try updating the B_PosterId in all of his/her posts.

1. Determine his/her U_Number
2. Run a query like this:
update w3t_Posts set B_PosterId = <his/her U_Number>
where U_Username = <his/her Username>

Hopefully that would do the trick, although with the join in the query, you shouldn't see any posts if the B_PosterId doesn't match.

Give it a try! (And backup your database beforehand!)

-Lance

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Thanks Lance Will give it a shot tomorrow


- Allen wavey
- What Drives You?
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Question, how do you determine someone's U_Number?


- Allen wavey
- What Drives You?
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
nevermind, found it


- Allen wavey
- What Drives You?
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Getting MySQL error:

code:

SQL-query :

update w3t_Posts set B_PosterId = <3>
where U_Username = <Allen>


MySQL said:


You have an error in your SQL syntax near '<3>
where U_Username = <Allen>' at line 1



(I practised on a local copy with my own name )


- Allen wavey
- What Drives You?
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
ok, got it to this:

code:

update w3t_posts set B_PosterId = 3
where B_Username = Allen


MySQL said:


Unknown column 'Allen' in 'where clause'



Any possible clues?


- Allen wavey
- What Drives You?
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
This should work:
code:

update w3t_Posts set B_PosterId = '3'
where B_Username = 'Allen'


Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Thanks I used that and it seemed to be ok to the forum, but it said: Rows Affected : 0

Does that mean it didn't make any changes? '3' is the U_Number and 'Allen' is the new name of the user. Should I use the old username in that spot? Or does this not affect older posts, only newer?


- Allen wavey
- What Drives You?
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
You should probably be able to do it with the old username as well, providing that it exists.

But I don't know the internals of this hack so I'm not really sure what has happened.

Joined: Aug 2002
Posts: 3
Lurker
Lurker
Offline
Joined: Aug 2002
Posts: 3
If no rows were affected, then that must mean the user has no posts at all.

-Lance

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
hmmm... he's the admin, user number 1, with >5k posts I did run it on his original name and it said 5k+ rows were affected, maybe it fixed it then, if not, I'll run the updated modification here again and see if it fixes it.


- Allen wavey
- What Drives You?
SurfMinister #217433 10/02/2002 4:27 PM
Joined: Dec 2000
Posts: 1,471
Addict
Addict
Offline
Joined: Dec 2000
Posts: 1,471
Small update to make the hack 6.1 compilant.
Fixed small bug in changeuser.php and added the U_LoginName field.
Attachments
58161-changeusername-2-0-3.zip (0 Bytes, 23 downloads)

Page 1 of 2 1 2

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Posts: 70
Joined: January 2007
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240430)