Advertisement
chrishajer

Add edit link to entry for use in export

Oct 3rd, 2012
800
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  1. <?php
  2. // http://www.gravityhelp.com/forums/topic/put-form-entry-url-into-form-field
  3. // change the 12 here to your form ID.
  4. add_action('gform_after_submission_12', 'add_edit_link', 10, 2);
  5. function add_edit_link($entry, $form) {
  6.     global $wpdb;
  7.  
  8.     // update this number 6 to the number of the hidden field in your form
  9.     $field_number = 6;
  10.  
  11.     // the Gravity Forms admin entry edit URL into the hidden field
  12.     $edit_url=  'http://www.website.com/wp-admin/admin.php?page=gf_entries&view=entry&id=' . $entry['form_id'] . '&lid=' . $entry['id'];
  13.  
  14.     // update the entry
  15.     $wpdb->insert("{$wpdb->prefix}rg_lead_detail", array(
  16.         'value'         => $edit_url,
  17.         'field_number'  => $field_number,
  18.         'lead_id'       => $entry['id'],
  19.         'form_id'       => $entry['form_id']
  20.     ));
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement