Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function my_update_company( $user_id, $contact_id, $user_meta ) {
- $company_id = get_user_meta( $user_id, 'hubspot_company_id', true );
- if ( empty( $company_id ) ) {
- return;
- }
- $data = array(
- 'property_one' => 'Value one',
- 'property_two' => 'Value two',
- );
- $properties = array();
- foreach( $data as $property => $value ) {
- $properties[] = array( 'property' => $property, 'value' => $value );
- }
- $params = wp_fusion()->crm->get_params();
- $params['body'] = json_encode( array( 'properties' => $properties ) );
- $params['method'] = 'PUT';
- $request = 'https://api.hubapi.com/companies/v2/companies/' . $company_id;
- $response = wp_remote_post( $request, $params );
- }
- add_action( 'wpf_pushed_user_meta', 'my_update_company', 10, 3 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement