XF 2.2 basic account setup from external app

jtorral

Member
I have an old external app which is not a forum or anything of the kind. However, I have thousands of users. Having said that, is there a doc that explains what tables in xenforo need to be loaded with minimal information to create accounts?

Would like to use sql to do this and just copy over existing userid, emails, name etc ... but what does xf require to be populated at a minimum?

Thanks
JT
 
Go to admin.php?data-portability/export and export a user account.

You can then inspect the file to see what data is required when importing at admin.php?data-portability/import.
 
Note however the import user function can only import one user at a time.

If you are planning to do a mass insert via sql, you will need to populate various tables - I don't have a full list of everything required for a user account.
It would likely be easier to write a small add-on piggybacking off the import user function.
 
Yea. I use the api to extract data from xf but cant figure out how to post a new users.

I already have the data I need to post from my db

Code:
$query = "SELECT u.userid, u.username, u.email, substr(md5(random()::text), 0, 10) AS password, t.timezone_value
         FROM users u, timezones t WHERE t.timezone_id = u.timezone AND 1 = $1 AND u.userid > 1 ORDER BY u.userid LIMIT 1";


$result  = pg_prepare($dbconnect, 'q_fp', $query);
$result  = pg_execute($dbconnect, 'q_fp', array(1) );
$numrows = pg_num_rows($result);


while ( $row = pg_fetch_row($result) ) {


   $userid   = $row[0];
   $username = $row[1];
   $email    = $row[2];
   $password = $row[3];
   $timezone = $row[4];


}

But don't know how to post to xf

Code:
$ch = curl_init();
   curl_setopt_array($ch, [
     CURLOPT_URL => $url,
     CURLOPT_RETURNTRANSFER => true,
     CURLOPT_ENCODING => "",
     CURLOPT_TIMEOUT => 0,
     CURLOPT_CUSTOMREQUEST => "POST",
     CURLOPT_HTTPHEADER => [ "XF-Api-Key: $xfApi" ]
   ]);


   $res = curl_exec($ch);


   if ( !($res = curl_exec($ch)) ) {
      $err = curl_error($ch) ;
      echo $err;
      curl_close($ch);
      exit;
   }
 
Top Bottom