Import Tools

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Post Reply

Rating:

Excellent!
16
50%
Very Good
9
28%
Good
4
13%
Fair
1
3%
Poor
2
6%
 
Total votes: 32

Extensions Robot
Extensions Robot
Extensions Robot
Posts: 27952
Joined: Sat Aug 16, 2003 7:36 am

Import Tools

Post by Extensions Robot » Fri Apr 29, 2005 7:43 pm

MOD Name: Import Tools
Author: Graham
MOD Description: This MOD will import a list of members held in a CSV* file and create user accounts for each of those members on the forum. Remember to protect the import folder and to delete the csv files after use.

* Comma Separated Variable
eg

Code: Select all

username,email,password
MOD Version: 1.0.2 (Updated 10/14/06)
Tested on phpBB Version: 2.0.21

Download File: Import_Tools_1.0.2.zip
mods overview page: View
File Size: 8605 Bytes



Support for this MOD needs to be asked within this topic. The phpBB Teams are not responsible or required to give anyone support for this MOD. By installing this MOD, the phpBB Support Team or phpBB MODifications Team may not be able to provide support.

This MOD has only been tested by the phpBB MOD Team with the phpBB version listed in the topic. It may not work in any other versions of phpBB.
Last edited by Extensions Robot on Mon Apr 30, 2007 12:29 am, edited 1 time in total.
(this is a non-active account manager for the phpBB Extension Customisations Team)

wGEric
Former Team Member
Posts: 8805
Joined: Sun Oct 13, 2002 3:01 am
Location: Friday
Name: Eric Faerber
Contact:

Post by wGEric » Thu May 12, 2005 9:18 pm

MOD Validated/Released

Notes:
This MOD will create users from a CSV file that is imported.
Eric

Graham
Former Team Member
Posts: 8462
Joined: Tue Mar 19, 2002 7:11 pm
Location: UK
Contact:

Post by Graham » Fri May 13, 2005 4:35 pm

Thanks Eric :)
"So Long, and Thanks for All the Fish"

phpBB Useful Links: Knowledge Base | Userguide | Forum Search | MOD Database | Styles Database
My Links: Blog!

presumined
Registered User
Posts: 29
Joined: Sun Jan 30, 2005 11:27 pm
Contact:

Post by presumined » Fri May 20, 2005 11:42 am

This is a great MOD and worked successfully, except I imported 2500 members into a new board and it shows them all as having joined on 1 January, 1970.

Naturally folks are bitching, so I was wondering if anyone had any idea how to change the joined date? Perhaps a MOD for this MOD?

Graham
Former Team Member
Posts: 8462
Joined: Tue Mar 19, 2002 7:11 pm
Location: UK
Contact:

Post by Graham » Fri May 20, 2005 4:40 pm

Strange, the code should set their registration date to the time you import them. The line to do it is certainly present, and it worked when I last tested it.
"So Long, and Thanks for All the Fish"

phpBB Useful Links: Knowledge Base | Userguide | Forum Search | MOD Database | Styles Database
My Links: Blog!

petes
Registered User
Posts: 72
Joined: Thu Feb 19, 2004 11:21 pm

Post by petes » Fri May 20, 2005 5:00 pm

When I have used it it placed the current date in there. My guess would be that something is wrong with the date data the script is receiving, and it is defaulting to the 1970 date. Possibly either the server date is wrong, in an unusable format, or not getting passed to the script. Just my guess...

presumined
Registered User
Posts: 29
Joined: Sun Jan 30, 2005 11:27 pm
Contact:

Post by presumined » Sat May 21, 2005 1:39 pm

Thanks for that fellers.

One thing - I can't take those members back out now, so does anyone have an idea how I can change those Date Joined fields at least to the date of my import (18 May)?

Or better still - is there any way I can just import the Date Joined field from my old database?

User avatar
3Di
Former Team Member
Posts: 14060
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Post by 3Di » Sat May 21, 2005 10:58 pm

Graham wrote: Strange, the code should set their registration date to the time you import them. The line to do it is certainly present, and it worked when I last tested it.


Reading topics somewhere in this very forum i've found this kind of 'suggestion' maybe related to this issue.
The time is probably milliseconds since Epoch (Jan 1 1970, midnight), since thats how many computers (and php!) computer the time


I hope this helps, dunno.

Greets.
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
👨‍🏫 | Take a tour to | The Studio | 👨‍🏫

petes
Registered User
Posts: 72
Joined: Thu Feb 19, 2004 11:21 pm

Post by petes » Sun May 22, 2005 2:10 am

presumined wrote: does anyone have an idea how I can change those Date Joined fields at least to the date of my import (18 May)?


I would determine the proper value for the date you want, and write an update query to update the user table for all users where the value is the one you want to replace. Hints, use phpMyAdmin, make a backup of the table first, make a fake user to test the proper value on.

presumined
Registered User
Posts: 29
Joined: Sun Jan 30, 2005 11:27 pm
Contact:

Post by presumined » Sun May 22, 2005 2:50 pm

Many thanks once again for the advice. I'll give that update query a try.

Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

Post by Joe Belmaati » Mon May 23, 2005 10:11 am

Code: Select all

UPDATE `phpbb_users` SET `user_regdate` = '1116374400'
This will set ALL users to have registered on May 18th 2005. If you need to do an interval you can try

Code: Select all

UPDATE `phpbb_users` SET `user_regdate` = '1116374400'
WHERE `user_id` > 2 LIMIT 2502;
Change 2502 to the number of users you imported and 3 to the number of the first imported user....

or even simpler

Code: Select all

UPDATE `phpbb_users` SET `user_regdate` = '1116374400'
WHERE `user_id` > 2
AND `user_id` < 2502;
Where 2 is the number of the first imported user and 2502 is the number of the last imported user


..or if you don't have access to phpMyAdmin you paste this into a file named something.php, upload it to your phpbb root dir and call it in your browser. After the update is done you should delete the file.

Code: Select all

<?php

$sql = array (
  0 => 'UPDATE `phpbb_users` SET `user_regdate` = \'1116374400\'
WHERE `user_id` > 2
AND `user_id` < 2502',
);

@set_time_limit(0);

if(!@file_exists('config.php')) die('config.php not found. make sure you have uploaded file to your forum directory.');
include('config.php');
$db = mysql_connect($dbhost, $dbuser, $dbpasswd);
if(!$db) die('Cannot connect: ' . mysql_error());
$res = mysql_select_db($dbname);
if(!$res) die('Cannot select database "' . $dbname . '": ' . mysql_error());
for($i=0; $i<count($sql); $i++)
{
 if($table_prefix !== 'phpbb_') $sql[$i] = preg_replace('/phpbb_/', $table_prefix, $sql[$i]);
 $res = mysql_query($sql[$i]);
 if(!$res) { echo 'error in query ', ($i + 1), ': ', mysql_error(), '<br />'; }
}
echo 'done (', count($sql), ' queries).';

?>
Again, you need to set the user_id numbers correctly.

I used the sql to php converter at phpbbstyles.com
Image

lmwood
Registered User
Posts: 1
Joined: Mon May 23, 2005 1:54 pm

Modifying the import tool.

Post by lmwood » Mon May 23, 2005 1:59 pm

This tool is great but...... how do i modify it so i can add a group to a user in the csv file.

eg.

username, email, password, group, msn, etc....

how do i modify it so i can add to the csv and it will import the data correctly????

Thanks in advance.. :D

Lee

Graham
Former Team Member
Posts: 8462
Joined: Tue Mar 19, 2002 7:11 pm
Location: UK
Contact:

Post by Graham » Mon May 23, 2005 5:33 pm

To add to a group, find this

Code: Select all

			$user = new user($username, $user_password, $email);
And after it add

Code: Select all

$user->add_to_group($member_data[x]);
(where x is the column the group_id is in in the file.

To set other fields, use

Code: Select all

$user->set_field('field_name', $member_data[x]);
"So Long, and Thanks for All the Fish"

phpBB Useful Links: Knowledge Base | Userguide | Forum Search | MOD Database | Styles Database
My Links: Blog!

sfm
Registered User
Posts: 6
Joined: Tue May 24, 2005 1:50 pm

Post by sfm » Tue May 24, 2005 1:57 pm

Graham,

Thanks for the great tool!

I just tryed to add the group function and am having no luck getting it to work. Everything else works great.

I added the following line to the admin_import_members file

$user->add_to_group($member_data[x]);

I changed the x to 4 since the group name is in the fourth colum of my .csv

Any ideas

petes
Registered User
Posts: 72
Joined: Thu Feb 19, 2004 11:21 pm

Post by petes » Tue May 24, 2005 3:25 pm

Shold it be 3? (0, 1, 2, 3)

Just a guess w/o looking at code...

Post Reply

Return to “[2.0.x] MOD Database Releases”