Advertisement
verygoodplugins

Untitled

Jul 20th, 2019
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1. function red_new_business_inquiry_submission( $entry, $form ) {
  2.  
  3.     add_filter( 'wpf_crm_object_type', function( $object_type ) {
  4.         return 'Inquiry_Form__c';
  5.     } );
  6.  
  7.     $contact_data = array(
  8.         'Contact__c' => rgar( $entry, '1.3' ),
  9.         'Name'       => rgar( $entry, '1.3' ),
  10.     );
  11.  
  12.     $object_id = wp_fusion()->crm->add_contact( $contact_data, false );
  13.  
  14.     if( is_wp_error( $object_id ) ) {
  15.  
  16.         wp_fusion()->logger->handle( $object_id->get_error_code(), $user_id, 'Error adding object to ' . wp_fusion()->crm->name . ': ' . $object_id->get_error_message() );
  17.  
  18.     }
  19.  
  20. }
  21. // UNCOMMENT TO ACTIVATE
  22. add_action( 'gform_after_submission_1', 'red_new_business_inquiry_submission', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement