Title: Creating a new record with php
Last modified: February 18, 2019

---

# Creating a new record with php

 *  Resolved [supernova42](https://wordpress.org/support/users/supernova42/)
 * (@supernova42)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/creating-a-new-record-with-php/)
 * I run a php routine to get the users WordPress name.
    I then check to see if 
   that user is on the PDB
 * If the user is on the PDB I use
    do_shortcode(‘[pdb_record fields=”username,boat_name,
   boat_model,boat_owner” record_id=’.$user_id.’]’); which allows the user to amend
   his record
 * If the user is not on PDB I use echo do_shortcode(‘[pdb_signup fields=”username”]’);
   to create a record with just the username. The shortcode requires the user to
   re-enter his username. The username is unique. To save this step, what code can
   I use for this routine to be carried out automatically and does not require the
   user to enter his username.
 * Many Thanks

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [supernova42](https://wordpress.org/support/users/supernova42/)
 * (@supernova42)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/creating-a-new-record-with-php/#post-11216452)
 * Finally I’ve got it working. Initially the routine below was creating a new record
   but the username field was empty for some reason. I’m not sure if I had a typo,
   but it now works.
 * $wp_username=’Enterprise’;
    $data=array(‘username’ => $wp_username); Participants_Db::
   write_participant($data);
 *  Thread Starter [supernova42](https://wordpress.org/support/users/supernova42/)
 * (@supernova42)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/creating-a-new-record-with-php/#post-11222390)
 * Thank you

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Creating a new record with php’ is closed to new replies.

 * ![](https://ps.w.org/participants-database/assets/icon-256x256.jpg?rev=1389807)
 * [Participants Database](https://wordpress.org/plugins/participants-database/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/participants-database/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/participants-database/)
 * [Active Topics](https://wordpress.org/support/plugin/participants-database/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/participants-database/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/participants-database/reviews/)

 * 2 replies
 * 1 participant
 * Last reply from: [supernova42](https://wordpress.org/support/users/supernova42/)
 * Last activity: [7 years, 2 months ago](https://wordpress.org/support/topic/creating-a-new-record-with-php/#post-11222390)
 * Status: resolved