Creating a PDB dummy record in php
-
If a record for a user does not exist in the Participants DB, then how can I create a dummy record which the user can later amend. I’ve included the code that I’m using to get the username from WordPress which in turn is used to find the associated record in PDB.
$current_user = wp_get_current_user();
$wp_username = $current_user->user_login;
$user_id = Participants_Db::get_record_id_by_term(‘username’, $wp_username);if(empty($user_id)) {
echo ‘$user_id is empty – Create a dummy record here’;
}
else { /* Record exists – display record */
$record = Participants_Db::get_participant($user_id);
echo do_shortcode(‘[pdb_record tabs=true fields=”username,name,address,city,country” record_id=’.$user_id.’]’);
}Many thanks
- The topic ‘Creating a PDB dummy record in php’ is closed to new replies.