• Hello,

    I want to be be able to check a customer meta feild and also update some custom feilds on AC.

    Here are is the hook and filter that I’m using. Please note that user might already be synced to AC.

    add_action( 'user_register', 'ac_validated_sync', 10, 1 );
    function ac_validated_sync( $user_id ) {
    	
    	$course_progress = get_user_meta( $user_id,'_sfwd-course_progress');
    	
    	if ($course_progress){
    		do_action('rusac_edit_address' , $user_id );
    	} else {
    		do_action('rusac_add_new_address' , $user_id );
    	}
    }
    
    add_filter('rusac_fetch_registered_user_data', 'custom_rusac_fetch_registered_user_data');
    function custom_rusac_fetch_registered_user_data($user_data, $user_id) {
    	
    	$course_progress = get_user_meta( $user_id,'_sfwd-course_progress');
    	
    	if ($course_progress){
    		$user_info = get_userdata( $user_id );
    		$user_data['PAID_CUSTOMER'] = "YES";
    		$user_data['REGISTRATION_DATE'] = $user_info->user_registered;
    	} else {
    		$user_data['PAID_CUSTOMER'] = "FLAGED";
    	}
    	
    	return $user_data;
    }
  • The topic ‘Adding/ Updating user’ is closed to new replies.