vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Link old ezboard member posts to their new accounts (https://vborg.vbsupport.ru/showthread.php?t=31443)

DarkReaper 10-26-2001 10:00 PM

Thanks to Stallion and FireFly for their input on this :)

Part I:

In register.php, Find this:

PHP Code:

$userid=$DB_site->insert_id(); 

AFTER it, add this:

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

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:
Code:

<?
/******************************************************************************
*                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/showthrea...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.


All times are GMT. The time now is 11:00 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01166 seconds
  • Memory Usage 1,751KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete