Created
          September 2, 2014 19:28 
        
      - 
      
- 
        Save greenhornet79/2a8ad06249669e2e9093 to your computer and use it in GitHub Desktop. 
    Add Gravity Forms data to custom database table
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | add_action('gform_after_submission', 'endo_add_entry_to_db', 10, 2); | |
| function endo_add_entry_to_db($entry, $form) { | |
| // uncomment to see the entry object | |
| // echo '<pre>'; | |
| // var_dump($entry); | |
| // echo '</pre>'; | |
| $source = $entry['source_url']; | |
| $email = $entry[5]; | |
| $param1 = $entry[2]; | |
| $param2 = $entry[3]; | |
| global $wpdb; | |
| // add form data to custom database table | |
| $wpdb->insert( | |
| 'custom_table_name', | |
| array( | |
| 'source_url' => $source, | |
| 'email' => $email, | |
| 'param1' => $param1, | |
| 'param2' => $param2, | |
| 'date' => current_time( 'mysql' ) | |
| ) | |
| ); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment