PDA

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


Freddie Bingham
11-11-2005, 10:00 PM
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 (https://vborg.vbsupport.ru/showthread.php?p=743904#post743904)

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.

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

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

?>

Daniel
11-11-2005, 11:27 PM
Will check it out
/me installs

Okie
11-12-2005, 05:43 AM
woow thankyou alot this is very usefull hack.. i have convert my board from IPB and i have alot of User that is deleted and showing as guest .. i think this hack going to help me as alot :)

Marco van Herwaarden
11-12-2005, 06:03 AM
Thank you Freddie for taking the time to convert this to 3.5.

I am sure that there are plenty members that will try to give support for this.

Alex Apple
11-12-2005, 07:46 AM
Freddie, you are a GOD! Thank you very much!

Snake
11-12-2005, 11:25 AM
Thanks Freddie! :)

EasyTarget
11-12-2005, 03:19 PM
wow, thank you. I asked on vbulletin.com how to do this and never got a response. I have all the old posts from ezboard just sitting in their own locked forum just waiting for this.

feldon23
11-14-2005, 07:07 PM
wow, thank you. I asked on vbulletin.com how to do this and never got a response. I have all the old posts from ezboard just sitting in their own locked forum just waiting for this.

Thanks, Freddie! :)

I really must learn this OOP stuff.

JonUrban
01-06-2006, 09:31 AM
This works GREAT! I just tried it on my vB 3.5.2 install, and it works perfectly.

THANKS!

:-jon
www.quadraphonicquad.com/forums

Big-K
08-30-2006, 02:26 PM
Does this work on 3.6.0?

perfphysio
09-16-2006, 11:03 AM
And does it work on 3.6.1

Actually I will try to see if it does so now. Wish me luck. Really it would be great if this was a standard feature on the admin cp :confused:

OK... the udpate is ....... wait for it.......... this all seems to work flawlessly on my new inport and subsequent upgrade form 3.6 to 3.6.1

thanks to all for making this possible

perfphysio
09-16-2006, 12:18 PM
And does it work on 3.6.1

Actually I will try to see if it does so now. Wish me luck. Really it would be great if this was a standard feature on the admin cp :confused:

OK... the udpate is ....... wait for it.......... this all seems to work flawlessly on my new inport and subsequent upgrade form 3.6 to 3.6.1

thanks to all for making this possible

I have run into one small problem. I have setup new user titles to match those in my old board. Once mapping the userid's the script suggests that I update the titles section, i.e. rerun it. I have done this several times and have also rerun the post counts for the users several times. The news users posts count all is displaying and searching correctly however the titles are remaining as if they have a post count of 0.

Is there something I am missing?

:confused:

mfarmerhi
11-20-2006, 09:46 PM
Can this script be used for associating old guest posts on your vB board with current users?

deeoo
12-03-2006, 12:44 PM
Works great on 3.6.4

NeutralizeR
08-03-2007, 05:13 PM
Wish it was possible to merge all of the deleted user accounts with a specific registered member account.

NeutralizeR
02-09-2008, 01:04 PM
Hello,

I need a small help with this script.

This is the script content:
<?
************************************************** *************************
* 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
*
*
************************************************** *****************************/

error_reporting(E_ALL & ~E_NOTICE);

define('THIS_SCRIPT', 'misafir');

$phrasegroups = array();
$specialtemplates = array();
$globaltemplates = array();
$actiontemplates = array();

require_once('./global.php');
require_once(DIR . '/includes/adminfunctions.php');

print_cp_header('Silinmiş ?ye Mesajı Aktarıcısı');

if ($_POST['do'] == 'update')
{
$vbulletin->input->clean_array_gpc('p', array(
'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']))
{

if (!($getuser = $db->query_first("SELECT userid FROM " . TABLE_PREFIX . "user WHERE username='Misafir'")))
{
echo "<b>Ge?ersiz bir ?ye adı girdiniz!</b><br />\n";
echo "<b>Misafir</b> adında bir ?ye kayıtlı değil.<br><br>\n";
}
else
{
echo "Silinmiş <b>" . $vbulletin->GPC['oldusername'] . "</b> hesabının mesajları <b>Misafir (#" . $getuser['userid'] . ")</b> hesabına aktarılıyor...";
$db->query_write("
UPDATE " . TABLE_PREFIX . "post
SET userid = $getuser[userid],
username = 'Misafir'
WHERE username = '" . $db->escape_string($vbulletin->GPC['oldusername']) . "'
");
$db->query_write("
UPDATE " . TABLE_PREFIX . "thread
SET postuserid = $getuser[userid],
postusername = 'Misafir'
WHERE postusername = '" . $db->escape_string($vbulletin->GPC['oldusername']) . "'
");
$db->query_write("
UPDATE " . TABLE_PREFIX . "thread
SET lastposter = 'Misafir'
WHERE lastposter = '" . $db->escape_string($vbulletin->GPC['oldusername']) . "'
");
$db->query_write("
UPDATE " . TABLE_PREFIX . "forum
SET lastposter = 'Misafir'
WHERE lastposter = '" . $db->escape_string($vbulletin->GPC['oldusername']) . "'
");
echo "<b>Bitti!</b><br /><br />\n";

if (!($totalposts = $db->query_first("SELECT COUNT(postid) AS posts FROM " . TABLE_PREFIX . "post WHERE userid = $getuser[userid]")))
{
$totalposts['posts'] = 0;
}
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET posts = $totalposts[posts] WHERE userid = $getuser[userid]");
echo "Misafir'in toplam mesaj sayısı <b>" . $totalposts['posts'] . "</b><br />\n";

echo "Şimdi ?ye başlıklarını g?ncellemelisiniz.<br /><br />\n";
}
}
else
{
echo "<b>Silinmiş ?yenin adını girmediniz!</b><br />\n";
echo "L?tfen silinmiş ?ye hesabının adını girip kaydet tuşuna tıklayınız.<br />\n";
}
echo '</td></tr></table>';
}

print_form_header('misafir', 'update');
print_table_header('Silinmiş ?yenin Mesajlarını Misafir Hesabına Aktarın');
print_input_row('Silinmiş ?yenin Adı', 'oldusername');
print_submit_row();
print_table_footer();

print_cp_footer();

?> It helps me to merge deleted members' posts with the "Misafir" account. I'm going to add this script to the modcp but there is a problem.

It doesn't check if a user is deleted or still registered. Moderators can move registered members' posts to "Misafir" account and i want to prevent this.

Shortly, i need a usergroup id check for

if $vbulletin->GPC['oldusername'] = $vbulletin->userinfo['usergroupid'] == 1Not sure how to do this.

Can you PLEASE tell me how to check if 'oldusername' is a usergroupid=1 or NOT.

Regards!

holwebs
02-12-2008, 12:44 PM
Am just reporting back that I've used this script fine with v3.6.8 (latest patch). :)

Re the comment on User Titles - if you go to User Titles in Admin after you've all your linking, change titles to what you want & click on the link on that screen 'Update User Titles' (or something similar), it works fine & all my users have their correct titles.