Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wpf_add_note_to_nationbuilder( $entry, $form ) {
- if ( ! function_exists( 'wp_fusion' ) ) {
- return;
- }
- $contact_id = gform_get_meta( $entry['id'], 'wpf_contact_id' );
- if ( ! empty( $contact_id ) ) {
- $params = wp_fusion()->crm->get_params();
- $body = array(
- 'note' => array(
- 'content' => $entry['4'],
- ),
- );
- $params['body'] = json_encode( $body );
- $request = 'https://' . wp_fusion()->crm->url_slug . '.nationbuilder.com/api/v1/people/' . $contact_id . '/notes/?access_token=' . wp_fusion()->crm->token;
- $response = wp_remote_post( $request, $params );
- }
- }
- add_action( 'gform_after_submission', 'wpf_add_note_to_nationbuilder', 10, 2 );
Add Comment
Please, Sign In to add comment