Transferring Records from WordPress to PD
-
[insert_php]
/*
Basically I want to transfer the username, email, first_name,
last_name from WordPress to Participants Database. Rather than export CSV files from WordPress and import them into Participants Database I thought something like this would work. I can just run the routine and it will do the transfer for me.
*/
for ($id=1; $id<=1000; $id++) {
$user = get_user_by( ‘id’, $id );
$wp_id = $user->id;
$wp_name = $user->user_login;
$wp_email = $user->user_email;
$wp_first_name = $user->user_firstname;
$wp_last_name = $user->user_lastname;if ($wp_name != ”) {
$user_id = Participants_Db::get_record_id_by_term(‘username’, $wp_name);if ($user_id != ”) {
echo ‘Record Exists – do nothing <br />’;
}
else {
echo ‘Create New Record <br />’;
/* WHAT GOES HERE */
}
}
}
[/insert_php]All works well. Records that exist in the WP and PD database are echoed as Record Exists. Records that exist in WP but not PD are echoed as Create New Record.
Two questions
1. Is there an easier way to do this and if so can you give me a few pointers.
2. I have the username, email, first_name, last_name for the records, but how do I create the NEW Records in PD with these values?Many Thanks
- The topic ‘Transferring Records from WordPress to PD’ is closed to new replies.