Back to vBulletin 3.5 Add-ons

Change Guest to User on threads (EZBoard)
Mod Version: 1.00, by Freddie Bingham

This modification is in the archives.
vB Version: 3.5.1 Rating: (1 vote - 5.00 average) Installs: 12
Released: 12 Nov 2005 Last Update: Never Downloads: 1
Not Supported  

This is an updated of the Ezboard Guest -> Registered user script. I took feldon's copy and hacked it up to 3.5 support.

The 3.0 version is here

Spoiler (click to open)


This script allows you to associate the imported posts from an EZBoard forum (which show up as username/Guest) with your newly registered vBulletin users. They will be able to edit their old posts, see their new avatars and signatures reflected in their old posts, and more importantly, their post count will include all of these old posts.

This script is particularly handy if users have already signed up on your new vBulletin forum or if users are registering with different usernames than they had on EZBoard.

You will still want to change each user's Join Date under their User options in AdminCP to reflect when they first registered on EZBoard. I may add this feature to a future revision of this script.

Supports: vBulletin 3.0.7
Should work with vBulletin 3.0.1-3.0.8 but have not had time to test.

Thanks to MarcoH64 for his assistance with this script!

I have really cleaned up the display of this script to look like a vB3 AdminCP panel. I have also added some basic idiot checks if you put a vB username that does not exist or leave one of the fields blank.

NOTE: PLEASE backup your database prior to using this script!

I consider this Pre-Release code and once it has been verified by other EZBoard users, I will release it here on vB.org. Please save this script as ezimport.php and place it in /admincp/

PHP Code:
<?
/******************************************************************************
*        ezboard import member converter 3.0b2
*        Originally By Jason "DarkReaper" Rodzik
*        Special Thanks to Firefly and Stallion
*        Updated to vBulletin 3.0.x by Feldon
*
*        http://www.unrealtournament.org/forums
*
*        Support for this hack at:
*        http://vbulletin.com/forum/index.php?t=31443
*******************************************************************************/


// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL E_NOTICE);

// ##################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT''ezimport');
define('NO_REGISTER_GLOBALS'1);

// #################### PRE-CACHE TEMPLATES AND DATA ######################
$phrasegroups = array();
$specialtemplates = array();

// ########################## REQUIRE BACK-END ############################
require_once('./global.php');
require_once(
'./includes/adminfunctions.php');
require_once(
'./includes/functions.php');

// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################

// #############################################################################

print_cp_header('EZBoard Post Associator');

if (
$_POST['do']=="update") {
    echo 
'<table cellpadding="4" cellspacing="0" border="0" align="center" width="90%" class="tborder"><tr><td class="alt1" style="padding-left: 20px; padding-top: 20px;">';
    
globalize($_POST, array(
        
'oldusername' => STR,
        
'newusername' => STR
    
));
    if (isset(
$oldusername) and isset($newusername)) {
     
$getuserid=$DB_site->query_first("SELECT userid FROM " TABLE_PREFIX "user WHERE username='".addslashes($newusername)."'");
        
$userid=$getuserid[userid];
        if (!isset(
$userid)) {
            echo 
"<b>You have entered an invalid vBulletin username!</b><br />\n";
            echo 
"There is no user by the name of <b>".addslashes($newusername)."</b> registered on this forum.<br><br>\n";
        } else {
        
            
// get hold of his/her posts and update threads
            
echo "Associating vB user <b>".$newusername." (#".$userid.")</b> with their EZBoard posts under username <b>".$oldusername."</b>...";
         
$DB_site->query("UPDATE " TABLE_PREFIX "post SET userid='$userid',username='".addslashes($newusername)."' WHERE username='".addslashes(htmlspecialchars($oldusername))."'");
         
$DB_site->query("UPDATE " TABLE_PREFIX "thread SET postuserid='$userid',postusername='".addslashes($newusername)."' WHERE postusername='".addslashes(htmlspecialchars($oldusername))."'");
         
$DB_site->query("UPDATE " TABLE_PREFIX "thread SET lastposter='".addslashes($newusername)."' WHERE lastposter='".addslashes(htmlspecialchars($oldusername))."'");
         
$DB_site->query("UPDATE " TABLE_PREFIX "forum SET lastposter='".addslashes($newusername)."' WHERE lastposter='".addslashes(htmlspecialchars($oldusername))."'");
            echo 
"<b>Done!</b><br /><br />\n";

            
// Update post counts
         
$totalposts=$DB_site->query_first("SELECT COUNT(postid) AS posts FROM " TABLE_PREFIX "post WHERE userid='$userid'");
         
$DB_site->query("UPDATE " TABLE_PREFIX "user SET posts='$totalposts[posts]' WHERE userid='$userid'");
            echo 
"New post count is <b>".$totalposts[posts]."</b><br />\n";
            
            echo 
"You should now update your member titles.<br /><br />\n";
        }
    } else {
        echo 
"<b>You have not entered a vBulletin username!</b><br />\n";
        echo 
"Please enter new and old usernames and then click Update!<br />\n";
    }
    echo 
'</td></tr></table>';
}

// #############################################################################

print_form_header(THIS_SCRIPT'update');
print_table_header("Merge vBulletin account with old EZBoard Posts");
print_input_row("vBulletin username","newusername","$newusername");
print_input_row("EZBoard username","oldusername","$oldusername");
print_description_row('<input type="submit" class="button" value="Submit"/>'02'thead');
print_table_footer();

print_cp_footer();

// #############################################################################

?>

Close


Please realize that I am extremely busy and probably won't be able to support this much. I do plan to integrate something more robust into vBulletin so you no longer need to come here to gain this functionality. Perhaps you can bug feldon23 for support? The 3.0/3.5 code differences are easy enough to understand when you compare the two.

Save this as ezimport.php and place it in your admincp directory. Also note that it has no Admincp permission checking so buyer beware.

PHP Code:
<?
/***************************************************************************
*        ezboard import member converter 3.0b2
*        Originally By Jason "DarkReaper" Rodzik
*        Special Thanks to Firefly and Stallion
*        Updated to vBulletin 3.0.x by Feldon
*            Updated to vBulletin 3.5.x by Freddie, pester Feldon for support
*
*        http://www.unrealtournament.org/forums
*
*        Support for this hack at:
*        http://vbulletin.com/forum/index.php?t=31443
*******************************************************************************/


// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// ##################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT''ezimport');

// #################### PRE-CACHE TEMPLATES AND DATA ######################
$phrasegroups = array();
$specialtemplates = array();
$globaltemplates = array();
$actiontemplates = array();

// ########################## REQUIRE BACK-END ############################
require_once('./global.php');
require_once(
DIR '/includes/adminfunctions.php');

// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################

// #############################################################################

print_cp_header('EZBoard Post Associator');

if (
$_POST['do'] == 'update')
{
    
$vbulletin->input->clean_array_gpc('p', array(
        
'newusername' => TYPE_NOHTML,
        
'oldusername' => TYPE_NOHTML,
    ));

    echo 
'<table cellpadding="4" cellspacing="0" border="0" align="center" width="90%" class="tborder"><tr><td class="alt1" style="padding-left: 20px; padding-top: 20px;">';
    if (!empty(
$vbulletin->GPC['oldusername']) AND  !empty($vbulletin->GPC['newusername']))
    {
        if (!(
$getuser $db->query_first("SELECT userid FROM " TABLE_PREFIX "user WHERE username='" $db->escape_string($vbulletin->GPC['newusername']) . "'")))
        {
            echo 
"<b>You have entered an invalid vBulletin username!</b><br />\n";
            echo 
"There is no user by the name of <b>" $vbulletin->GPC['newusername'] . "</b> registered on this forum.<br><br>\n";
        }
        else
        {
            
// get hold of his/her posts and update threads
            
echo "Associating vB user <b>" $vbulletin->GPC['newusername'] . " (#" $getuser['userid'] . ")</b> with their EZBoard posts under username <b>" $vbulletin->GPC['oldusername'] . "</b>...";
         
$db->query_write("
             UPDATE " 
TABLE_PREFIX "post
             SET userid = 
$getuser[userid],
                 username = '" 
$db->escape_string($vbulletin->GPC['newusername']) . "'
             WHERE username = '" 
$db->escape_string($vbulletin->GPC['oldusername']) . "'
         "
);
         
$db->query_write("
             UPDATE " 
TABLE_PREFIX "thread
             SET postuserid = 
$getuser[userid],
                 postusername = '" 
$db->escape_string($vbulletin->GPC['newusername']) . "'
             WHERE postusername = '" 
$db->escape_string($vbulletin->GPC['oldusername']) . "'
         "
);
         
$db->query_write("
             UPDATE " 
TABLE_PREFIX "thread
             SET lastposter = '" 
$db->escape_string($vbulletin->GPC['newusername']) . "'
             WHERE lastposter = '" 
$db->escape_string($vbulletin->GPC['oldusername']) . "'
         "
);
         
$db->query_write("
             UPDATE " 
TABLE_PREFIX "forum
             SET lastposter = '" 
$db->escape_string($vbulletin->GPC['newusername']) . "'
             WHERE lastposter = '" 
$db->escape_string($vbulletin->GPC['oldusername']) . "'
         "
);
         echo 
"<b>Done!</b><br /><br />\n";

         
// Update post counts
         
if (!($totalposts $db->query_first("SELECT COUNT(postid) AS posts FROM " TABLE_PREFIX "post WHERE userid = $getuser[userid]")))
         {    
// some versions of mysql like to return nothing if there are no matching rows when they should return 0
             
$totalposts['posts'] = 0;
         }
         
$db->query_write("UPDATE " TABLE_PREFIX "user SET posts = $totalposts[posts] WHERE userid = $getuser[userid]");
         echo 
"New post count is <b>" $totalposts['posts'] . "</b><br />\n";

            echo 
"You should now update your member titles.<br /><br />\n";
        }
    }
    else
    {
        echo 
"<b>You have not entered a vBulletin username!</b><br />\n";
        echo 
"Please enter new and old usernames and then click Update!<br />\n";
    }
echo 
'</td></tr></table>';
}

// #############################################################################

print_form_header('ezimport''update');
print_table_header('Merge vBulletin account with old EZBoard Posts');
print_input_row('vBulletin username''newusername');
print_input_row('EZBoard username''oldusername');
print_submit_row();
print_table_footer();

print_cp_footer();

// #############################################################################

?>

Download

No files for download.

Similar Mods

Guest,s Can,t see the Threads vBulletin 2.x Full Releases

vblts.ru supports vBulletin®, 2022-2025