Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function store_additional_license_parameters($response, $args, $license_id) {
- $data = $_REQUEST;
- if($response['license'] == 'valid' && !empty($data['crm'])) {
- $user = get_user_by('email', $response['customer_email']);
- update_user_meta($user->ID, 'active_crm', $data['crm']);
- update_user_meta( $user->ID, 'last_license_check', date('m/d/Y') );
- if( isset($data['integrations']) && is_array( $data['integrations'] ) ) {
- update_user_meta($user->ID, 'active_integrations', implode(', ', $data['integrations']));
- }
- $contact_id = wp_fusion()->user->get_contact_id($user->ID);
- $update_data = array(
- 'email' => $user->user_email,
- 'field[17,0]' => $data['crm'],
- 'field[20,0]' => date('m/d/Y')
- );
- if( isset($data['integrations']) && is_array( $data['integrations'] ) ) {
- $update_data['field[19,0]'] = '||' . implode('||', $data['integrations']) . '||';
- }
- if( isset( $data['version'] ) ) {
- update_user_meta($user->ID, 'wpf_version', $data['version'] );
- }
- wp_fusion()->crm->update_contact($contact_id, $update_data, false);
- }
- return $response;
- }
- add_filter( 'edd_remote_license_check_response', 'store_additional_license_parameters', 10, 3);
- add_filter( 'edd_remote_license_activation_response', 'store_additional_license_parameters', 10, 3);
Add Comment
Please, Sign In to add comment