PDA

View Full Version : correct joindate when converting from phpbb!


msimonds
01-13-2004, 10:00 PM
I have a script that will correct the user regdate from phpbb to vbulletin so you will not get the registration date of 1969 or 1970 for those of you that have had problems with this is the past. I had this problem going from the nuke/phpbb port ---->to a standalone phpbb----->to vbulletin anyone is interested so when you convert your forums the correct registration date will appear and place the unix date back into the table!. Please let me know what you think of this script! I have tested this at least 10 times:

MAKE A BACKUP OF YOUR phpbb_users table and data before you run this script!


<?
/************************************************** *****************/
/* Place this file in the same folder as config.php */
/************************************************** *****************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$sql = "SELECT user_id, user_regdate FROM phpbb_users";
$result = $db->sql_query($sql);
while($record = $db->sql_fetchrow($result)) {
extract($record);
$user_regdate = str_replace(',',' ',$user_regdate);
$date = explode(' ',$user_regdate,3);
switch($date[0]) {
case('Jan'): $m=1; break;
case('Feb'): $m=2; break;
case('Mar'): $m=3; break;
case('Apr'): $m=4; break;
case('May'): $m=5; break;
case('Jun'): $m=6; break;
case('Jul'): $m=7; break;
case('Aug'): $m=8; break;
case('Sep'): $m=9; break;
case('Oct'): $m=10; break;
case('Nov'): $m=11; break;
case('Dec'): $m=12; break;
}
$newDate = mktime(0, 0, 0, $m, $date[1], $date[2]);
echo $user_id.' -- '.$user_regdate.' = '.$newDate.' = '.date('m d Y',$newDate).'<br />';
/************************************************** *****************/
/* When you are satisfied that the code is working correctly, */
/* uncomment the following 2 lines and resubmit the script. */
/************************************************** *****************/
//$sql = "UPDATE phpbb_users set user_regdate = $newDate where user_id = $user_id";
//$result1 = $db->sql_query($sql);
}
?>


name it whatever you want. I named it correct.php

thanks

Mike

Zachery
01-14-2004, 03:43 PM
all you should need to do is update the users and such via the ACP ?

msimonds
01-14-2004, 03:50 PM
yes but what about if you have a large board that you are converting from phpbb. I have alomst 3000 members (which is not that large) do I really want to edit each member's joindate or user_regdate. This does it automatically

Zachery
01-14-2004, 04:39 PM
in vB2 and vB3 there is a function to update counters which updates various info which can be done via the ACP, which will update this info for you

msimonds
01-15-2004, 03:53 AM
You are not reading my hack properly. If you are switching from the phpnuke version of phpbb it does not store the date like the standalone phpbb does. Hence when you move the nukebb to phpbb before you import it into vbulletin you can run this script and it will convert the date for you in the database, so when you import it all your current members will have their correct registtration date. I am just trying to help people out that is all!!!

As far as this control panel in VB2 & VB3m, it will not correct the joindate in the users table if it is either blank or zero, that is when you get the date of 1969 or 1970