View Single Post
  #16  
Old 07-28-2005, 02:18 PM
feldon23's Avatar
feldon23 feldon23 is offline
 
Join Date: Oct 2001
Posts: 124
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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/showthread.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"/>', 0, 2, 'thead');
print_table_footer();

print_cp_footer();

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

?>
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01212 seconds
  • Memory Usage 1,812KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete