Advertisement
verygoodplugins

Untitled

Oct 15th, 2019
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1. function my_gform_after_submission( $entry, $form ) {
  2.  
  3.     // Gets the first name and last name from field ID 3, and email from field ID 4
  4.     $contact_data = array(
  5.         'FirstName' => rgar( $entry, '3.3' ),
  6.         'LastName'  => rgar( $entry, '3.6' ),
  7.         'Email'     => rgar( $entry, '4' )
  8.     );
  9.  
  10.     $contact_id_one = wp_fusion()->crm->add_contact( $contact_data, false );
  11.  
  12.     add_filter(
  13.         'wpf_crm_object_type', function( $object_type ) {
  14.             return 'Lead';
  15.         }
  16.     );
  17.  
  18.     // Gets the first name and last name from field ID 5, and email from field ID 6
  19.     $contact_data = array(
  20.         'FirstName' => rgar( $entry, '5.3' ),
  21.         'LastName'  => rgar( $entry, '5.6' ),
  22.         'Email'     => rgar( $entry, '6' ),
  23.         'Company'   => 'Foo',
  24.     );
  25.  
  26.     $contact_id_two = wp_fusion()->crm->add_contact( $contact_data, false );
  27. }
  28.  
  29. // Replace "1" with the ID of the form
  30. add_action( 'gform_after_submission_1', 'my_gform_after_submission', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement