News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Import Members from Profile Manager 3 to SMF

Started by RCG, July 13, 2008, 10:41:05 AM

Previous topic - Next topic

RCG

I currently have 100+ users registered in my CGI database. The datafile is PM.DAT (flat file) and would like to import the user information into SMF. Any suggestions?

ThorstenE

can you post one line from the PM.DAT? it should not be very hard to import the users only..maybe it looks like this:
usernane##mail##passwort##...

RCG

#2
Here is the example you requested - Line 1 = Header -- Line 2 = Data

login|ID|password|update_date|register_date|IP|sortable_register_date|sortable_update_date|firstname|lastname|email|sfx|seclvl|mbrno|mt|address|city|st|zip|home|cell|work|bday|membdate|ofc_brd|mailing|trainer|obed|agil|rally|puppy|helper|apprentice|level|photo|occupation|committee|hobbies|notes|news|quote|dues|dues_yr|ppr|keyfab|kf_dep|sponser1|sponser2|sbday|active
GriffithR|998853730|****|June 20, 2008|February 6, 2008|71.113.151.214|20081089|20081171|Robert|Griffith|[email protected]| |9|1989-2279|Family|9690 Windgate Dr.|Bloomington|IL|61705-5514|309-829-2279|309-530-5877| |Aug-12|Feb-1989| |yes|no|no|no|no|no|no|no| | |Retired - 1999, GTE (IT-Adv Systems Engineer) <img src=http://www.tckc.org/members/cgi/images/smilie_smile.gif border=0>|-Web Support#|Family, Dogs, Friends and the Web Site|Can't wait till Spring is here!|Nothing new, just enjoying life!|--it Happens!| | |GriffithR|3722401|5.00|Joyce Cline| |08/12|yes|

I primarily need the "login,password,email" data but would like to expand SMF data items if possible (not critical).

Thanks
RCG

Edit, Removed password

ThorstenE

try this:
Code (import_users.php) Select

<?php

$importfile 
"PM.DAT";
$escape "|";

require_once(
dirname(__FILE__) . '/Settings.php');

$db_connection mysql_connect($db_server$db_user$db_passwd);
$db mysql_select_db($db_name);
$import file($importfile);

//remove the first line (description of user data)
array_shift($import);


foreach (
$import as $lines) {
$users explode($escape,$lines);

$regdate strtotime($users['4']);

mysql_query("
INSERT IGNORE INTO 
{$db_prefix}members
(memberName, ID_GROUP, realName , passwd, dateRegistered, emailAddress)
VALUES ('
$users[0]', '0', '$users[0]' , '$users[2]','$regdate', '$users[10]' )");
}
mysql_close($db_connection);
echo 
'IMPORT COMPLETE!';
?>

save as import_users.php and upload to your SMF-Folder... copy the PM.DAT to SMF folder, after that call it from browser.. for example http://yoursite.com/import_users.php

This is a Quick'n'Dirty Solution without checking duplicates or correcting the stats. After import go to Admin - Forum Maintenance - Find and repair any errors and Recount all forum totals and statistics.

RCG


pcshme

TE
thanks in advance for your help
in this example
does the php file want to see

"|" as the delimiter?
or  comma's as the delimiter?

trying to import my customer base into memebers

here's an example of what i tried without sucmess using your php app.

CHICAGO60617|0|200 PHARMACY|INC.|60617|12/3/2008|[email protected]

i can make it comma delim,  or "string","string" 
etc

let me know
thanks
mike

ThorstenE

delimiter is the $escape = "|";
have you tried more than one line in your test?

the script above drops the first line (in profile manager the first line contains the column description)

remove:
array_shift($import);
from the example script.

PS: If you already have a comma seperated list you can use phpMyAdmin for the import.

ne-yola

hello,

I need a script like this, I have the email addresses of the users, and i need a script that would use thesame email address as username and create a default paswd for the users.

It would also send them a mail for the users stating their password

Pls help , am a novice

Advertisement: