Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wpf_delete_user() {
- $post_data = apply_filters( 'wpf_crm_post_data', $_REQUEST );
- if ( empty( $post_data ) || empty( $post_data['contact_id'] ) ) {
- wp_die();
- }
- $args = array(
- 'meta_key' => wp_fusion()->crm->slug . '_contact_id',
- 'meta_value' => $post_data['contact_id'],
- 'fields' => array( 'ID' ),
- );
- $users = get_users( $args );
- // If user is found
- if ( isset( $users[0] ) ) {
- wp_delete_user( $users[0]->ID );
- }
- do_action( 'wpf_api_success', $users[0]->ID, 'update' );
- }
- add_action( 'wpf_delete', 'wpf_delete_user' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement