PDA

View Full Version : Change Guest to User on threads (EZBoard)


Teresa
01-30-2004, 11:25 PM
Freddie just updated my vB3 with my old EZBoard posts. Worked GREAT! Yea.

Now I'd like to be able to convert the old GUEST userid's to registered members (including my own) as the new come over and register on the site.

I think I've found two vB tables: POSTS and THREADS that contain the userid and the user name.

I manually changed one post to test it, and changing the userid from zero to the correct userid number works perfectly.

So, I just need a simple script to search for users of a certain name and change the associated userid's to the appropriate number.

ALSO, I need to rerun some query to properly update the number of posts for that user.

Anybody??

Titus
05-28-2004, 04:09 PM
Sorry to bump this, but I too would like this hack. Our board is planning on moving off of ezBoard very soon, and I really, really do not want to import to vb2, and then upgrade to 3.

If someone could update this hack (https://vborg.vbsupport.ru/showthread.php?s=&threadid=31443) to vB3, I would be incredibly grateful.

Thanks!

Titus
05-31-2004, 01:44 PM
Pretty Please?

*blinks bambi-eyes*

dstruct2k
05-31-2004, 03:16 PM
Actually, that code looks like it would work with vb3 as well... At least, the part where it links new registrants to old accounts.

I'll still look for antiquated functions and fix if needed, but I think it's good. :)

dstruct2k
05-31-2004, 03:23 PM
Alright, it was just missing TABLE_PREFIX's but I added them and cleaned up the code. :)

In register.php find: $userid = $DB_site->insert_id();

After add: // get hold of his posts and update threads
$DB_site->query("UPDATE " . TABLE_PREFIX . "post SET userid='$userid' WHERE username='".addslashes(htmlspecialchars($_POST['username']))."' AND visible<>0");
$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET postuserid='$userid' WHERE postusername='".addslashes(htmlspecialchars($_POST['username']))."' AND visible<>0");
$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'");

:D

Titus
06-01-2004, 02:36 AM
Awesome, thanks!

Berethorn
07-07-2004, 11:54 PM
Is this a proven working script, then? :) And if I someone registers with their username before the old posts move from ezboard, will those old posts not get linked? :)

Titus
08-16-2004, 03:28 PM
It worked great for me. I deleted all the user accounts that had been registered prior to our ezboard being moved over, so I can't say whether or not this would work with an existing user.

Hmm.. If you have a lot of users registered already, and they want their old posts back, I would say you would (short of writing a merge hack, which I recall seeing for vb2 somewhere) change the existing user name (Like: Bob2), then have the person register their old name (Bob), and then merge the two together.

Lots of trouble to go through though.

lazserus
09-12-2004, 05:11 PM
Has anyone figured how to implement these hacks after the board has been converted by vB? I've been with vB for over a year and no hack I've tried links usernames. For instance, my username here is the same on my board, but all the old EzBoard posts (under the exact same name) show me as a guest. I see how hacking the register.php would link NEW users to a guest name, but I need to link currently registered members over. The vB2 script did this, but it doesn't work for vB3.

I'm not a coder, so I can't write a script for it. I'm also not about to make 600 of my members register again and do merging. That's just too much.

feldon23
07-18-2005, 10:40 PM
This works on vB3.0.7?

Alex Apple
07-27-2005, 03:47 PM
This works on vB3.0.7?

I'm in the same boat. I'm about to convert an ezboard over to vBulletin but this user question is going to be key.

The only way I think this might be possible is use the ezboard-->phpBB converter available here (http://sourceforge.net/projects/ezboard-conv), which I've tested and which seems to work quite well. It's basically a spider, but which creates dummy accounts. It gives all the dummy usernames the same dummy password and email, but it's obviously changeable (bit of a security risk though). I'm currently planning to do the ezb-->phpBB import, and then use Impex to import the phpBB database. It's a bit long-winded, but I can't see much other of a way round.

feldon23
07-27-2005, 05:35 PM
I'm in the same boat. I'm about to convert an ezboard over to vBulletin but this user question is going to be key.

The only way I think this might be possible is use the ezboard-->phpBB converter available here (http://sourceforge.net/projects/ezboard-conv), which I've tested and which seems to work quite well. It's basically a spider, but which creates dummy accounts. It gives all the dummy usernames the same dummy password and email, but it's obviously changeable (bit of a security risk though). I'm currently planning to do the ezb-->phpBB import, and then use Impex to import the phpBB database. It's a bit long-winded, but I can't see much other of a way round.

I tried to rewrite the EZBoard user importer posted here:
https://vborg.vbsupport.ru/showthread.php?t=31443 (http://vbulletin.com/forum/showthread.php?t=31443)

to work with vBulletin 3 but I have failed. I am now having to restore a forum database because of it.

The problem is that one of the users I imported has an apostrophe in their name.


EDIT: Please see the updated version of this script later down the page that fixes various bugs and cleans up the rest of the code.

Marco van Herwaarden
07-27-2005, 07:56 PM
Change:
$getuserid=$DB_site->query_first("SELECT userid FROM user WHERE username='$newusername'");

to:
$getuserid=$DB_site->query_first("SELECT userid FROM user WHERE username='" . addslashes($newusername) . "'");
Do that everywhere the username is used in a query.

feldon23
07-27-2005, 10:22 PM
Change:
$getuserid=$DB_site->query_first("SELECT userid FROM user WHERE username='$newusername'");

to:
$getuserid=$DB_site->query_first("SELECT userid FROM user WHERE username='" . addslashes($newusername) . "'");
Do that everywhere the username is used in a query.

Should I go ahead and do addslashes(htmlspecialchars($newusername)) for every occurence of $newusername to be thorough?

Also wrestling with getting some kind of CSS to load.

Marco van Herwaarden
07-28-2005, 03:26 AM
Only addslashes, never said anything about htmlspecialchars.

feldon23
07-28-2005, 02:18 PM
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/

<?
/************************************************** ****************************
* 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();

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

?>

swepics
08-02-2005, 10:18 AM
I did this and named it ezboard.php. When I enter in the two names to merge, I get this message:

Not Found
The requested URL /forums/admincp/ezimport.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Was I supposed to name this bit of code anything in particular when I put it in the admincp?

feldon23
08-02-2005, 11:39 AM
I did this and named it ezboard.php. When I enter in the two names to merge, I get this message:

Was I supposed to name this bit of code anything in particular when I put it in the admincp?

I forgot to mention the filename. Yes, the filename is hardcoded as ezimport.php. You can either rename it to ezimport.php or change:
print_form_header('ezimport', 'update');
to
print_form_header('ezboard', 'update');


Updated my original note.

a squared
09-27-2005, 12:24 AM
I will be importing from ezBoard shortly and would like to run this script. I see that this should work in v 3.0.8 Has anyone run it yet in 3.0.8 or 3.0.9?

I wanted to add that I'm a new vB user running v 3.0.8

a squared
10-04-2005, 03:36 AM
Hi, installed and ran the script last night. Got a database error:



Database error in vBulletin 3.0.8:

Invalid SQL: SELECT userid FROM user WHERE username='LSIntegra94'
mysql error: Table 'slotcari_vBforums.user' doesn't exist

mysql error number: 1146


If it helps, I have a table named "slotcari_vBforums.vb3_user"


.

Marco van Herwaarden
10-04-2005, 03:54 AM
Change:
$getuserid=$DB_site->query_first("SELECT userid FROM user WHERE username='".addslashes($newusername)."'");
To:
$getuserid=$DB_site->query_first("SELECT userid FROM " . TABLE_PREFIX . "user WHERE username='".addslashes($newusername)."'");

feldon23
10-04-2005, 11:19 AM
Change:
$getuserid=$DB_site->query_first("SELECT userid FROM user WHERE username='".addslashes($newusername)."'");
To:
$getuserid=$DB_site->query_first("SELECT userid FROM " . TABLE_PREFIX . "user WHERE username='".addslashes($newusername)."'");


Thanks, Marco! As always, an invaluable member of vb.org. :)

I've updated the script to reflect this change.

a squared
10-04-2005, 01:13 PM
Thank you both!!! I saw the post this morning and immediately changed the code. uploaded and ran the script. Ran without a hitch! Is it safe to assume that this script is now supports all versions of vB 3.0.x? It certainly works in 3.0.8

Thanks again

Mike

feldon23
10-05-2005, 03:53 PM
Thank you both!!! I saw the post this morning and immediately changed the code. uploaded and ran the script. Ran without a hitch! Is it safe to assume that this script is now supports all versions of vB 3.0.x? It certainly works in 3.0.8

Thanks again

Mike

To my knowledge, the user, post, thread, and forum tables did not change from vB3.0.0 through 3.0.9. Anyone?

vocalise
11-10-2005, 07:02 PM
Will this work on vbulletin 3.5.0? Freddie just did a wonderful job importing my board from ezboard to vbulletin, and I'm kind of lost what to do with the script (excuse this very new newbie)

I saved the script to ezimport.php and uploaded it.

Do I just access it from http://mydomain.com/admincp/ezimport.php and then run it that way? I ask because I'm getting errors. I must be something.

Any help would be greatly appreciated.

feldon23
11-10-2005, 07:26 PM
Will this work on vbulletin 3.5.0? Freddie just did a wonderful job importing my board from ezboard to vbulletin, and I'm kind of lost what to do with the script (excuse this very new newbie)

I saved the script to ezimport.php and uploaded it.

Do I just access it from http://mydomain.com/admincp/ezimport.php and then run it that way? I ask because I'm getting errors. I must be something.

Any help would be greatly appreciated.

I have not tested it in vB3.5.0. What error(s) are you getting?

vocalise
11-10-2005, 07:30 PM
I am getting the following errors:

Notice: Only variable references should be returned by reference in /home/vocalise/public_html/includes/class_core.php on line 1824

Notice: Only variable references should be returned by reference in /home/vocalise/public_html/includes/class_core.php on line 1771

Notice: Only variables should be assigned by reference in /home/vocalise/public_html/includes/class_core.php on line 1510

feldon23
11-10-2005, 07:46 PM
I am getting the following errors:

Notice: Only variable references should be returned by reference in /home/vocalise/public_html/includes/class_core.php on line 1824

Notice: Only variable references should be returned by reference in /home/vocalise/public_html/includes/class_core.php on line 1771

Notice: Only variables should be assigned by reference in /home/vocalise/public_html/includes/class_core.php on line 1510

Guess I need to learn how to code for vB3.5. What would be really nice is if Jelsoft took this project over and officially supported it.

akanevsky
11-10-2005, 08:17 PM
Install my port of the Advanced Editing Options for Mods and Admins, then you get to have such feature :)

vocalise
11-11-2005, 01:22 AM
I installed the port of the Advanced Editing Options, and it seems to be installed properly.

However, when I got to http://_mydomain_/admincp/ezimport.php

I am still getting the same errors..

Freddie Bingham
11-11-2005, 09:22 PM
Guess I need to learn how to code for vB3.5. What would be really nice is if Jelsoft took this project over and officially supported it.Yes, I'll see if I can get something done soon.

Alex Apple
11-11-2005, 09:39 PM
Thanks for the tip, DarkVisor. But is there any way to globally change the author of a number of "guest" posts (all by the same person) in your port, other than go through and find each post manually? feldon23's script for the 3.0.x line basically asked for the ezboard username, and the new registered username, and linked them together. I can't see a way to do this on the Advanced Editing Options other than finding each post manually - not a viable option on a 60,000 post board.

Vocalise, to get the Advanced Editing Options working, go to Edit Post--> Advanced, and you should see some new options there.

EDIT: Brilliant news Freddie, you are a star!

Freddie Bingham
11-14-2005, 06:51 PM
3.5.x version is here (https://vborg.vbsupport.ru/showthread.php?t=100615)