View difference between Paste ID: SXRvEcVv and kxksfyjB
SHOW: | | - or go back to the newest paste.
1
// ******CREATE NEW MEMBER IN MY HR SUPPORT CENTER****** //
2-
  function create_member_in_mhrsc( $user_id, $infusionsoft_contact_id, $post_data ) {   
2+
  function create_member_in_mhrsc( $user_id, $post_data ) {   
3
4
      // Check if there's already a contact record
5
6-
      $wp_user  =   $user_id;
6+
7
8
      $mhrsc_member_id  =   get_user_meta( $user_id, 'hrsupportcenteruid', true );
9
      $user_st          =   get_user_meta( $user_id, 'billing_state', true );
10-
      $mhrsc_member_id  =   get_user_meta( $wp_user, 'hrsupportcenteruid', true );
10+
      $user_co          =   get_user_meta( $user_id, 'billing_company', true  );
11-
      $user_st          =   get_user_meta( '192', 'billing_state', true );
11+
12-
      $user_co          =   get_user_meta( $wp_user, 'billing_company', true  );
12+
13
      error_log( $user_co.' is the company');
14
15
16
      if( ! empty( $mhrsc_member_id ) ) {
17
      
18
        return $mhrsc_member_id;
19
20
        error_log('Member already exists');
21
22
      } else {
23
        
24
        $cid    =   $infusionsoft_contact_id;
25
26
        $url = MYHRSC_GF_USERS_SB_URL;
27
        $method = "POST";
28
29
		$cid = wp_fusion()->user->get_contact_id( $user_id );
30
31
        member_data( $user_id, $cid, $url, $method, $user_st, $user_co );
32
33
      } //endelse   
34
   
35
  }  // endfunction: create_member_in_mhrsc()
36
37
// ******CREATE NEW MEMBER IN MY HR SUPPORT CENTER****** //
38-
add_action( 'wpf_user_created', 'create_member_in_mhrsc', 10, 3 );
38+
add_action( 'wpf_user_updated', 'create_member_in_mhrsc', 10, 2 );