Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
5 + 8 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
     

Re: Xoops (User) Importer
by ghia on 2010/10/22 6:05:35

See also this script, which I suppose will still run.
Xoops (User) Importer
by hiflyer on 2010/10/22 2:38:51

Ted Smith wrote a module XoopsImporter https://xoops.org/modules/news/article.php?storyid=2969 that was very handy but apparently doesn't work with the new user database for 2.4
Any chance anyone can update this? I assume just the code below needs to be updated.
I would also love the option to define a Group for each user.

le="color: #000000"><?php // Get the data from import file---------------------------------------------------------------------------------------- echo ("Beginning file import process...(scroll to bottom to see all results and confirmation) <br /> <br />"); $count = 0; while (!feof($InputFileExists)) //Start of While Loop { $GetData = fgets($InputFileExists,4096); // Get data and place in array 4096 bytes per slot $count++; $ArraySlots = explode("$charDeliminationCharacter",$GetData); // Define the array and $Username = $ArraySlots[0]; // 1st column from input file $RealName = $ArraySlots[1]; // 2nd column from input file $Email = $ArraySlots[2]; // 3rd column from input file $URL = $ArraySlots[3]; // 4th column from input file $ICQ = $ArraySlots[4]; // 5th column from input file $AIM = $ArraySlots[5]; // 6th column from input file $YIM = $ArraySlots[6]; // 7th column from input file $MSNM = $ArraySlots[7]; // 8th column from input file $Location = $ArraySlots[8]; // 9th column from input file $Signature = $ArraySlots[9]; // 10h column from input file $Occupation = $ArraySlots[10]; // 11th column from input file $Interest = $ArraySlots[11]; // 12th column from input file $ExtraInfo = $ArraySlots[12]; // 13th column from input file $Password = sprintf("%sn",md5($ArraySlots[13])); // 14th column from input file - Calc the MD5 value and store // Insert all the values from input file into the database --------------------------------------------------------------- $xoops_usersVar = ($strDatabaseXoopsPrefix.'users'); // Assign value of DB prefix for entry into 'DBprefix_users' table $query = "INSERT INTO $xoops_usersVar (uname, name, email, url, user_icq, user_aim, user_yim, user_msnm, user_from, user_sig, user_occ, user_intrest, bio, pass) VALUES ('$Username','$RealName','$Email','$URL','$ICQ','$AIM','$YIM','$MSNM','$Location','$Signature','$Occupation','$Interest','$ExtraInfo','$Password')"; $result = mysql_query($query); $uid = mysql_insert_id(); if (mysql_error()) { echo "There's an error in the database : ".mysql_error(); echo "<br>Sorry, import process aborted. Please examine the error and re-try"; fclose($InputFileExists); mysql_close($sqlconnection); exit(); } //Increment the UserID starting from the last User ID (detects last ID and autoincrements.)For each entry, display the result on the screen until EOF is reached. ------------------------------------------------ $Groups_Users_LinkVar = ($strDatabaseXoopsPrefix.'groups_users_link'); $numgroup = '2'; $insertvalues = "INSERT INTO $Groups_Users_LinkVar (groupid, uid) VALUES('$numgroup', '$uid')"; $result= mysql_query($insertvalues); if (mysql_error()) { echo "There's an error in the database : ".mysql_error(); echo "<br>Sorry, import process aborted. Please examine the error and re-try"; fclose($InputFileExists); mysql_close($sqlconnection); exit(); } else { echo "Username ".$Username." imported OK, ID - ".$uid." <br /> "; } } //End of While loop


Thanks!!

Who's Online

205 user(s) are online (155 user(s) are browsing Support Forums)


Members: 0


Guests: 205


more...

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits