Link old ezboard member posts to their new accounts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DarkReaper
    Senior Member
    • May 2001
    • 731

    Link old ezboard member posts to their new accounts

    Thanks to Stallion and FireFly for their input on this

    Part I:

    In register.php, Find this:

    PHP Code:
    $DB_site->query("INSERT INTO userfield $userfieldsnames VALUES ($userid$userfields)"); 
    AFTER it, add this:

    PHP Code:
    $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
    Last edited by DarkReaper; Sat 27 Oct '01, 9:34am.
    Seriously! - The Definitive Home of All Things Serious
    Seriously! Forums

    To recieve support on these forums, enter your username here.
  • Joshua Clinard
    Banned
    • Oct 2001
    • 552
    • 3.0.0 Gamma

    #2
    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!

    Comment

    • Martz
      Senior Member
      • Apr 2001
      • 1051

      #3
      Nice addition Darkreaper
      HP DL-380 G6, 2x E5520, 28GB RAM, 4x300GB SAS, VMWare ESXi
      -
      Unreal Tournament : Assault forums - irc://irc.utassault.net:6667 -

      Comment

      • Chen
        Senior Member
        • Jun 2001
        • 8388

        #4
        Save this file as whatever you want .php and upload to your admin folder:
        Code:
        <?
        /******************************************************************************
        *		ezboard import member converter
        *		By Jason "DarkReaper" Rodzik
        *		Special Thanks to Firefly and Stallion
        *
        *		[url]http://www.unrealtournament.org/forums[/url]
        *
        *
        *		Support for this hack at:
        *		[url]http://vbulletin.com/forum/showthread.php?s=&threadid=31443[/url]
        *******************************************************************************/
        
        
        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.
        Last edited by Chen; Sat 27 Oct '01, 9:25am.
        Chen Avinadav
        Better to remain silent and be thought a fool than to speak out and remove all doubt.

        גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

        Comment

        • Freddie Bingham
          Former vBulletin Developer
          • May 2000
          • 14057
          • 1.1.x

          #5
          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.

          Comment

          • DarkReaper
            Senior Member
            • May 2001
            • 731

            #6
            Thanks FireFly, I updated the attachment

            freddie: Great!
            Seriously! - The Definitive Home of All Things Serious
            Seriously! Forums

            To recieve support on these forums, enter your username here.

            Comment

            • Joshua Clinard
              Banned
              • Oct 2001
              • 552
              • 3.0.0 Gamma

              #7
              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...

              Comment

              • DarkReaper
                Senior Member
                • May 2001
                • 731

                #8
                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?
                Seriously! - The Definitive Home of All Things Serious
                Seriously! Forums

                To recieve support on these forums, enter your username here.

                Comment

                • Joshua Clinard
                  Banned
                  • Oct 2001
                  • 552
                  • 3.0.0 Gamma

                  #9
                  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...
                  Last edited by Joshua Clinard; Sat 27 Oct '01, 3:12pm.

                  Comment

                  • DarkReaper
                    Senior Member
                    • May 2001
                    • 731

                    #10
                    Try rebuilding your search index. That *should* fix it.
                    Seriously! - The Definitive Home of All Things Serious
                    Seriously! Forums

                    To recieve support on these forums, enter your username here.

                    Comment

                    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                    Working...