Advertisement
chrishajer

add a hidden unique ID to the entry based on entry ID

Sep 12th, 2012
3,731
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  1. <?php
  2. // http://www.gravityhelp.com/forums/topic/entry-ids
  3. // update the 93 here to your form ID
  4. add_action('gform_after_submission_93', 'add_submission_id', 10, 2);
  5. function add_submission_id($entry, $form) {
  6.     global $wpdb;
  7.     // update this to the number of the hidden field in your form
  8.     $field_number = 4;
  9.     // your submission ID format to be inserted into the hidden field
  10.     $SubmissionID = 'A' . $entry['id'];
  11.     // update the entry
  12.     $wpdb->insert("{$wpdb->prefix}rg_lead_detail", array(
  13.         'value'         => $SubmissionID,
  14.         'field_number'  => $field_number,
  15.         'lead_id'       => $entry['id'],
  16.         'form_id'       => $entry['form_id']
  17.     ));
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement