Advertisement
verygoodplugins

Untitled

May 6th, 2020
1,151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. function my_update_account( $user_id, $user_meta ) {
  2.  
  3.     $account_id = get_user_meta( $user_id, 'ac_account_id', true );
  4.  
  5.     if ( ! empty( $account_id ) ) {
  6.  
  7.         $params = wp_fusion()->crm->get_params();
  8.  
  9.         $data = array(
  10.             'accountCustomFieldDatum' => array(
  11.                 'accountId'     => $account_id,
  12.                 'customFieldId' => 2,
  13.                 'fieldValue'    => 'NEW VALUE',
  14.             ),
  15.         );
  16.  
  17.         $params['body'] = json_encode( $data );
  18.  
  19.         wp_remote_post( wp_fusion()->crm->api_url . '/api/3/accountCustomFieldData', $params );
  20.  
  21.     }
  22.  
  23. }
  24.  
  25. add_action( 'wpf_user_updated', 'my_update_account', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement