PDA

View Full Version : Link old ezboard member posts to their new accounts


DarkReaper
10-26-2001, 10:00 PM
Thanks to Stallion and FireFly for their input on this :)

Part I:

In register.php, Find this:


$userid=$DB_site->insert_id();


AFTER it, add this:


// get hold of his posts and update threads
$DB_site->query("UPDATE post SET userid='$userid' WHERE username='".addslashes(htmlspecialchars($username))."' AND visible<>0");
$DB_site->query("UPDATE thread SET postuserid='$userid' WHERE postusername='".addslashes(htmlspecialchars($username))."' AND visible<>0");
$totalposts=$DB_site->query_first("SELECT COUNT(postid) AS posts FROM post WHERE userid='$userid'");
$DB_site->query("UPDATE user SET posts='$totalposts[posts]' WHERE userid='$userid'");


From now on, when a user registers with the same username they posted with on ezboard, their old posts will be linked to their new member account.

If people have already registered, or if they want a new nickname, you can use the attached script I made. Just edit $newusername and $oldusername and upload to your /admin directory, then run it(be sure to rename it to .php instead of .php.text :)).

Yea, I know it doesn't have fancy menus or anything, but I didn't think it was worth the time and effort to do that...so sue me, or do it better, I'd appreciate the latter more ;)

Updated - 10/27/01: Added FireFly's menu code. Thanks :)

Joshua Clinard
10-27-2001, 02:49 PM
Is there anyway you can update this script so that you can type the old and new usernames in a form and press an update button, instead of having to upload the script 100 times?

I would be SO greatful if someone could do this. It would totally ROCK!

Martz
10-27-2001, 03:16 PM
Nice addition Darkreaper :)

Admin
10-27-2001, 04:21 PM
Save this file as whatever you want .php and upload to your admin folder:
<?
/************************************************** ****************************
* ezboard import member converter
* By Jason "DarkReaper" Rodzik
* Special Thanks to Firefly and Stallion
*
* http://www.unrealtournament.org/forums
*
*
* Support for this hack at:
* http://vbulletin.com/forum/showthread.php?s=&threadid=31443
************************************************** *****************************/


error_reporting(7);
require("./global.php");
$thisscript=substr($PHP_SELF, 0, strlen($PHP_SELF)-4);

cpheader();

if ($HTTP_POST_VARS['action']=="update") {
if (isset($oldusername) and isset($newusername)) {
$getuserid=$DB_site->query_first("SELECT userid FROM user WHERE username='$newusername'");
$userid=$getuserid[userid];

// get hold of his posts and update threads
$DB_site->query("UPDATE post SET userid='$userid',username='$newusername' WHERE username='".addslashes(htmlspecialchars($oldusername))."'");
$DB_site->query("UPDATE thread SET postuserid='$userid',postusername='$newusername' WHERE postusername='".addslashes(htmlspecialchars($oldusername))."'");
$DB_site->query("UPDATE thread SET lastposter='$newusername' WHERE lastposter='".addslashes(htmlspecialchars($oldusername))."'");
$DB_site->query("UPDATE forum SET lastposter='$newusername' WHERE lastposter='".addslashes(htmlspecialchars($oldusername))."'");

// Update post counts
$totalposts=$DB_site->query_first("SELECT COUNT(postid) AS posts FROM post WHERE userid='$userid'");
$DB_site->query("UPDATE user SET posts='$totalposts[posts]' WHERE userid='$userid'");
echo "Fixing user with ID of $userid and posts are $totalposts[posts]\n\nYou should now update your member titles.";
} else {
echo "Please enter new and old usernames.";
}
}

doformheader("$thisscript","update");
maketableheader("Update user stuff");
makeinputcode("His new username","newusername","$newusername");
makeinputcode("His old username","oldusername","$oldusername");
doformfooter("Update!");

cpfooter();

?>
Just added some fancy code, includes a form now so you can just enter two usernames and click update.

Freddie Bingham
10-27-2001, 04:30 PM
I'll see if I can't put something in the CP that will help with this or just reinstating a user who you deleted. There is already an option to rebuild post counts in the next version.

DarkReaper
10-27-2001, 04:35 PM
Thanks FireFly, I updated the attachment :)

freddie: Great! :)

Joshua Clinard
10-27-2001, 08:28 PM
For some reason, if the old and new usernames are not the same, it will not work. I tried this with a few of my users, and instead of the usual message it said

Fixing user with ID and posts are 8900 You should now update your member titles.

There was No user ID, and I think the 8900 is the number of total posts on the board. Anyway, I hope this doesn't mess anything up. It's not a big, deal, I don't have to have it, but I was just letting people know that it doesn't work...The rest of it works great though...

On the other hand thier are a few users on my board that changed usernames...

DarkReaper
10-27-2001, 08:49 PM
It works fine for me when they're different. If it didn't, I wouldn't have released it ;)

What version of vBulletin are you running? Are you sure that you're inputting the EXACT nicknames correctly? And that you're putting the old username and new username in the correct box?

What are some of the old/new usernames that are giving you problems?

Joshua Clinard
10-27-2001, 10:10 PM
I am running the most cuurent version. 2.0.3. The usernames I tried were hooky27 to Alex....Eson to Emerson...

I just tired it again and got thepotterconnection to Wizard Girl to work...

Don't know why...I am confused. Thanks for the help though.

well it said it worked..but I don't think it did...the posts don't show up in the search for username...I think I messed it up...now not even the posts she has posted since vbulletin show up....

Is there anyway to fix this...

DarkReaper
10-27-2001, 11:14 PM
Try rebuilding your search index. That *should* fix it.

feldon23
11-01-2001, 05:54 PM
Freddie,

Thanks for everything getting me switched over from EZBoard. I can't believe I waited so long to switch to vBulletin. It is everything I wanted and now with a few customizations like DarkReaper's script here, it's as if we were always here and the memory of EZBoard is fading fast.

At first, I thought $80 was a bit much, now I realize it is a steal for what vBulletin does.

Without going crazy, I've already started customizing pages. I did find a bug that I hope a future version will fix, and something hard-coded that bugged me.

The topic list will only display the topic smiley $thread[info] that was selected the first time the post was made. Changing the smiley (or adding one) after the fact won't put it in the topic list.

And that brings me to the 2nd point. I changed the icons and realized that the forumdisplay.php code has 15x15 pixel icons hard-coded.

Off-topic, but how do I put the "users currently viewing the board" panel on the thread list? I tried using the token and I tried copying the code from the token. Neither worked.

Joshua Clinard
11-27-2001, 07:33 PM
I added the sript to register.php, and it does not work. Is this compatible with 2.2.1? If so, haw can I get it to work?

Please Help!

DarkReaper
11-27-2001, 10:28 PM
What do you mean it doesn't work? Could you please be more specific?

Joshua Clinard
11-28-2001, 01:54 AM
It just does not link there posts to their profile. I had several users sign up with the same name, and then I could go look through the forums, and find old posts, and they would not be linked. Even after updating the post information. But, after using the ezconvert script, it would work. Please help. I don't want to have to do this manually for my 300+ users!

Joshua Clinard
12-01-2001, 03:03 AM
Can ANYONE please help me install this? If you need my server info, I will PM it to you!

Joshua Clinard
12-06-2001, 12:55 AM
Help! I can't open my board until I get this installed! I would be most appreciative if someone would help me.

Link old ezboard member posts to their new accounts (https://vborg.vbsupport.ru/showthread.php?postid=204028#post204028)

I modified the register.php file, and tested it, but it did not work.

Is this script compatible with 2.2.1? If not, can it be updated? I really need this hack for my board. I would be willing to pay someone to get this working. If someone is willing to help, I will e-mail them the ftp info as neccesarry.

Admin
12-06-2001, 01:34 PM
Weird, seems the code in the first post doesn't work. I could've sworn it was differenet. :confused:

Anyway, Joshua, in register.php find this:
$userid=$DB_site->insert_id();
and right after it add this code:
// get hold of his posts and update threads
$DB_site->query("UPDATE post SET userid='$userid' WHERE username='".addslashes(htmlspecialchars($username))."' AND visible<>0");
$DB_site->query("UPDATE thread SET postuserid='$userid' WHERE postusername='".addslashes(htmlspecialchars($username))."' AND visible<>0");
$totalposts=$DB_site->query_first("SELECT COUNT(postid) AS posts FROM post WHERE userid='$userid'");
$DB_site->query("UPDATE user SET posts='$totalposts[posts]' WHERE userid='$userid'");
This is the exact code we use on this board, so it has to work. :)

Joshua Clinard
12-07-2001, 03:14 AM
Thank You a thousand times over!! I can't thank you enough FireFly! How much do I owe ya?

This is an awesome hack!

Admin
12-07-2001, 11:05 AM
No problem Joshua. :)

(you should've e-mailed me earlier, eh? ;))

Joshua Clinard
12-07-2001, 02:53 PM
Sure should have! I have another question related to this. The ezconvert script has been working for the times that I want to change somone's username. Except for one. I need to change Ginny 2002 to Valerie, and it did not work. Is there a way to go through the tables and chang the username, then I can just run the convert script to add the profile info?

Admin
12-07-2001, 03:00 PM
E-mail me with phpMyAdmin access and I'll fix it for you.

MarkB
12-10-2001, 06:05 AM
Very cool (altho I'm just using the script Firefly posted, linked from my Admin CP) -- I have a couple of hosted forums that were ezboard imports, and my users are chuffed to be able to get their postcounts back :)

DarkReaper
12-10-2001, 07:10 PM
Thanks Firefly...and sorry guys, but I don't have much time for my site itself anymore, let alone yours ;)

DannyITR
01-31-2002, 02:20 PM
I will be requesting an import from ezboard very soon.

I plan to use the code you provided in register.php.
I have a question: I found the line in the file but to I insert this hack directly after the semicolon or after the little 0s that appear after every semicolon?

Can you explain in a little more detail what you mean by linking? Does this mean once the import is complete, any user who registers under the same name as one that has an imported post will be given that post count?

What about the second file that was provided in this thread? Something about just typing in two user names? I made this file as well but can someone tell me what it does in english?

Thanks guys

DarkReaper
01-31-2002, 07:39 PM
Linking means associating all the posts under that username with their account. You'll notice that if its not linked in, it'll just show a name, and mark them as guest. This makes it so it actually counts as a post made by them.

The second file is for linking in users who have already registered, or who registered with a different name, into their old posts.

Tannerman
03-25-2002, 01:22 PM
Hello. Recently had Jellsoft perform the "ezboard to vBulletin" import, and that came out great (yep, another vB customer running from the evils of inferior products - don't even get me started on my experiences with UBB6). I'm interested in getting this hack installed to so users are tied to posts (I've got a very small group of users who posts I transferred... about 10 users total). I've been trying to follow this thread as it was recommended to me on the vB forums, but with the revisions and modifications discussed, I'm a little lost.

I was wondering if someone could install this hack for me correctly (DarkReaper, FireFly?). I'd be more than happy to provide access to the server, etc. If not, I suppose I could try modifying this somehow... albeit, I'm a newbie, and really don't want to mess this thing up :)

One other question I had regarding this hack. If I understand it correctly, it needs to be installed before any users register with the same usernames, in order for the posts to be tied to the user. Am I correct in this assumption?

Regarding this, when I installed vBulletin, I created a username for myself that is the admin name that I'd like to use throughout the board (and had previously used on my ezboard), however, I'm assuming that my old posts cannot be tied to this username (even though they are the same names) because I needed to register after installing this hack (Follow that?). Is there any way to retroactively tie my posts to my username even though I'm already a registered user?

Please feel free to PM or e-mail me for clarification if I'm just blowing air here :) Thanks for reading, and have a great day.

- Steve

Greystang302
06-21-2002, 12:25 AM
I imported from UBB 6.2 to vB 2.2.6, and for some reason the import didn't merge my admin account. I had two identical accounts! The one imported from UBB remained dormant. Deleted the old admin account, which marked all of those posts as 'Guest', then uploaded Firefly's script, ran it, and it worked like a champ!

Thanks!

TheEDIGuy
08-09-2002, 02:21 PM
I just wanted to say "Thanks" for a great and highly useful hack. We moved a very large BB from ezBoard to vBulletin, and our users are extremely happy to have their old posts re-linked with their new names.

John

Tailfeathers
09-29-2002, 10:45 PM
I have a question about this hack:
When it links new usernames to old posts by those usernames, does it also update post count and registration date (from first post), or not?

Thanks for this wonderful hack! When I convert, I will definitely be using it. :)

007
02-17-2003, 08:58 AM
THANK YOU THANK YOU THANK YOU!!!!!!! If I would have known this hack existed I would have been 100% hyped for my purchase of vB before buying it. I was still pretty excited about it, but now THIS completes every wish I had for it. THANK YOU! :)

*Clicks Install*

Works like a charm! :)