Advertisement
verygoodplugins

Untitled

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