'NO', 'es_registered_group' => 0, ); $form_data = get_option( 'ig_es_sync_wp_users', array() ); $form_data = wp_parse_args( $form_data, $default_form_data ); ?>
display_name; $email = $user_info->user_email; if ( empty( $user_first_name ) ) { $user_first_name = ES_Common::get_name_from_email( $email ); } // prepare data $data = array( 'first_name' => $user_first_name, 'email' => $email, 'source' => 'wp', 'status' => 'verified', 'hash' => ES_Common::generate_guid(), 'created_at' => ig_get_current_date_time(), 'wp_user_id' => $user_id, ); do_action( 'ig_es_add_contact', $data, $list_id ); } } } } /** * Delete contact from ES when user deleted from WordPress * * @param $user_id * * @since 4.3.12 */ public function delete_contact( $user_id = 0 ) { $ig_es_sync_wp_users = get_option( 'ig_es_sync_wp_users', array() ); if ( ! empty( $ig_es_sync_wp_users ) ) { $ig_es_sync_wp_users = maybe_unserialize( $ig_es_sync_wp_users ); $ig_es_registered = ( ! empty( $ig_es_sync_wp_users['es_registered'] ) ) ? $ig_es_sync_wp_users['es_registered'] : 'NO'; if ( 'YES' === $ig_es_registered ) { if ( ! empty( $user_id ) ) { global $wpdb; $user = get_user_by( 'ID', $user_id ); if ( $user instanceof WP_User ) { $email = $user->user_email; $where = $wpdb->prepare( 'email = %s', $email ); $contact_id = ES()->contacts_db->get_column_by_condition( 'id', $where ); if ( $contact_id ) { ES()->contacts_db->delete_contacts_by_ids( $contact_id ); } } } } } } public function prepare_sync_user() { $audience_tab_main_navigation = array(); $active_tab = 'sync'; $audience_tab_main_navigation = apply_filters( 'ig_es_audience_tab_main_navigation', $active_tab, $audience_tab_main_navigation ); ?>