__( 'Contact', 'email-subscribers' ), 'plural' => __( 'Contacts', 'email-subscribers' ), 'ajax' => false, 'screen' => 'es_subscribers', ) ); $this->db = new ES_DB_Contacts(); add_filter( 'ig_es_audience_tab_main_navigation', array( $this, 'get_audience_main_tabs' ), 10, 2 ); // @since 4.3.1 add_action( 'ig_es_form_deleted', array( $this, 'set_default_form_id' ), 10, 1 ); } /** * Add Screen Option * * @since 4.2.1 */ public static function screen_options() { // Don't show screen option on Import/ Export subscribers page. $action = ig_es_get_request_data( 'action' ); if ( empty( $action ) ) { $option = 'per_page'; $args = array( 'label' => __( 'Number of contacts per page', 'email-subscribers' ), 'default' => 100, 'option' => self::$option_per_page, ); add_screen_option( $option, $args ); } } /** * Get the content of Audience main tab * * @param $active_tab * @param array $audience_main_tabs * * @return array * * @since 4.0.0 */ public function get_audience_main_tabs( $active_tab, $audience_main_tabs = array() ) { $audience_tab_main_navigation = array( 'new_contact' => array( 'label' => __( 'Add New Contact', 'email-subscribers' ), 'indicator_option' => '', 'indicator_label' => '', 'indicator_type' => '', 'action' => 'new', 'url' => add_query_arg( 'action', 'new', 'admin.php?page=es_subscribers' ), ), 'import' => array( 'label' => __( 'Import Contacts', 'email-subscribers' ), 'indicator_option' => '', 'indicator_label' => '', 'indicator_type' => '', 'action' => 'import', 'url' => add_query_arg( 'action', 'import', 'admin.php?page=es_subscribers' ), ), 'export' => array( 'label' => __( 'Export Contacts', 'email-subscribers' ), 'indicator_option' => '', 'indicator_label' => '', 'indicator_type' => '', 'action' => 'export', 'url' => add_query_arg( 'action', 'export', 'admin.php?page=es_subscribers' ), ), // Start-IG-Code. /* 'sync' => array( 'label' => __( 'Sync', 'email-subscribers' ), 'indicator_option' => 'ig_es_show_sync_tab', 'indicator_label' => __( 'New', 'email-subscribers' ), 'indicator_type' => 'new', 'action' => 'sync', 'url' => add_query_arg( 'action', 'sync', 'admin.php?page=es_subscribers' ), ), */ // End-IG-Code. 'manage_lists' => array( 'label' => __( 'Manage Lists', 'email-subscribers' ), 'indicator_option' => '', 'indicator_label' => '', 'indicator_type' => '', 'action' => 'manage-lists', 'is_imp' => true, 'url' => add_query_arg( 'action', 'manage-lists', 'admin.php?page=es_lists' ), ), ); $audience_main_tabs = $audience_main_tabs + $audience_tab_main_navigation; if ( ! empty( $active_tab ) && isset( $audience_main_tabs[ $active_tab ] ) ) { unset( $audience_main_tabs[ $active_tab ] ); } return $audience_main_tabs; } /** * Render Audience View * * @since 4.2.1 */ public function render() { ?>
load_import(); } elseif ( 'export' === $action ) { $this->load_export(); } elseif ( 'new' === $action || 'edit' === $action ) { $contact_id = absint( ig_es_get_request_data( 'subscriber' ) ); $this->save_contact( $contact_id ); } elseif ( 'sync' === $action ) { update_option( 'ig_es_show_sync_tab', 'no' ); // yes/no $this->load_sync(); } else { $audience_tab_main_navigation = array(); $active_tab = ''; $audience_tab_main_navigation = apply_filters( 'ig_es_audience_tab_main_navigation', $active_tab, $audience_tab_main_navigation ); ?>


get_contacts_reports(); ?>
prepare_items(); // Display Advanced Filter block do_action('ig_es_render_advanced_filter'); ?>
prepare_lists_dropdown(); $this->prepare_statuses_dropdown(); // Display bulk action fields, pagination and list items. $this->display(); ?>

export_subscribers_page(); } /** * Load import * * @since 4.0.0 */ public function load_import() { $import = new ES_Import_Subscribers(); $import->import_subscribers_page(); } /** * Load Sync * * @since 4.0.0 */ public function load_sync() { $sync = ES_Handle_Sync_Wp_User::get_instance(); $sync->prepare_sync_user(); } /** * Get Contacts Reports * * @since 4.3.1 */ public function get_contacts_reports() { $args = array( 'days' => 60 ); $es_total_contact = ES_Reports_Data::get_total_contacts(); $es_total_subscribed_contacts = ES_Reports_Data::get_total_subscribed_contacts( $args ); $es_total_unsubscribed_contacts = ES_Reports_Data::get_total_unsubscribed_contacts( $args); $es_total_unconfirmed_contacts = ES_Reports_Data::get_total_unconfirmed_contacts( $args ); $es_total_contacts_opened_emails = ES_Reports_Data::get_total_contacts_opened_emails( $args ); ?>
' . __( 'Manage Lists', 'email-subscribers' ) . ''; } else { $is_new = false; $title = __( ' Edit Contact', 'email-subscribers' ); $title_action = ' ' . __( 'Add New', 'email-subscribers' ) . ''; $contact = $this->db->get( $id ); if ( ! empty( $contact ) ) { $first_name = ig_es_get_data( $contact, 'first_name' ); $last_name = ig_es_get_data( $contact, 'last_name' ); $email = sanitize_email( ig_es_get_data( $contact, 'email' ) ); $guid = ig_es_get_data( $contact, 'hash' ); $contact_cf_data = apply_filters( 'es_prepare_cf_data_for_contact_array', $contact ); $list_ids = ES()->lists_contacts_db->get_list_ids_by_contact( $id ); } } $submitted = ig_es_get_request_data( 'submitted' ); if ( 'submitted' === $submitted ) { $contact_nonce = ig_es_get_request_data( 'ig_es_contact_nonce' ); // Verify nonce. if ( wp_verify_nonce( $contact_nonce, 'ig-es-contact-nonce' ) ) { $contact_data = ig_es_get_data( $_POST, 'contact_data', array(), true ); $is_error = false; if ( ! empty( $contact_data ) ) { $email = sanitize_email( ig_es_get_data( $contact_data, 'email', '', true ) ); if ( $email ) { $lists = ig_es_get_data( $contact_data, 'lists', array() ); if ( count( $lists ) > 0 ) { $first_name = ig_es_get_data( $contact_data, 'first_name', '', true ); $last_name = ig_es_get_data( $contact_data, 'last_name', '', true ); $contact = array( 'first_name' => $first_name, 'last_name' => $last_name, 'email' => $email, 'status' => 'verified', ); $contact = apply_filters( 'es_set_additional_contact_data', $contact, $contact_data ); //For submitted custom fields $contact_cf_data = apply_filters( 'es_prepare_cf_data_for_contact_array', $contact_data, true ); // Add contact. $existing_contact_id = ES()->contacts_db->get_contact_id_by_email( $email ); if ( $existing_contact_id && ( $existing_contact_id != $id ) ) { $message = __( 'Contact already exist.', 'email-subscribers' ); ES_Common::show_message( $message, 'error' ); $is_error = true; } elseif ( ! empty( $contact['status'] ) && 'ERROR' === $contact['status'] ) { $message = ES_Handle_Subscription::get_messages( $contact['message'] ); ES_Common::show_message( $message, 'error' ); $is_error = true; } else { if ( $id ) { ES()->contacts_db->update_contact( $id, $contact ); } else { $contact['source'] = 'admin'; $contact['status'] = ! empty( $contact['status'] ) ? $contact['status'] : 'verified'; $contact['hash'] = ES_Common::generate_guid(); $contact['created_at'] = ig_get_current_date_time(); $id = ES()->contacts_db->insert( $contact ); } } if ( ! $is_error ) { $lists = ! empty( $lists ) ? $lists : array( 1 => 0 ); $existing_subscribed_lists = ES()->lists_contacts_db->get_list_ids_by_contact( $id, 'subscribed' ); ES()->lists_contacts_db->update_contact_lists( $id, $lists ); $updated_subscribed_lists = ES()->lists_contacts_db->get_list_ids_by_contact( $id, 'subscribed' ); // Lists whose status changed to unconfirmed or unsubscribed from subscribed. $changed_lists = array_diff( $existing_subscribed_lists, $updated_subscribed_lists ); // Check if admin has updated status of any subscribed lists. if ( ! $is_new && ! empty( $changed_lists ) ) { do_action( 'ig_es_admin_contact_unsubscribe', $id, 0, 0, $changed_lists ); } if ( $id ) { if ( $is_new ) { if ( ! empty( $contact_data['send_welcome_email'] ) ) { // Get comma(,) separated list name based on ids. $list_name = ES_Common::prepare_list_name_by_ids( $list_ids ); $name = ES_Common::prepare_name_from_first_name_last_name( $contact['first_name'], $contact['last_name'] ); $template_data = array( 'email' => $contact['email'], 'contact_id' => $id, 'name' => $name, 'first_name' => $contact['first_name'], 'last_name' => $contact['last_name'], 'guid' => $contact['hash'], 'list_name' => $list_name, ); // Send Welcome Email. ES()->mailer->send_welcome_email( $contact['email'], $template_data ); } $contact_edit_url = menu_page_url( 'es_subscribers', false ); $contact_edit_url = add_query_arg( array( 'subscriber' => $id, 'action' => 'edit', ), $contact_edit_url ); /* translators: 1. Contact edit URL tag 2: Anchor close tag */ $message = sprintf( __( 'Contact added successfully. %1$sEdit contact%2$s.', 'email-subscribers' ), '', '' ); // Reset form data $first_name = ''; $last_name = ''; $email = ''; $lists = ''; $id = 0; $contact_cf_data['custom_fields'] = array(); } else { $message = __( 'Contact updated successfully!', 'email-subscribers' ); } ES_Common::show_message( $message, 'success' ); } } } else { $message = __( 'Please select list', 'email-subscribers' ); ES_Common::show_message( $message, 'error' ); } } else { $message = __( 'Please enter valid email address', 'email-subscribers' ); ES_Common::show_message( $message, 'error' ); } } } } $data = array( 'id' => $id, 'first_name' => $first_name, 'last_name' => $last_name, 'email' => $email, 'guid' => $guid, ); if ( isset( $contact_cf_data['custom_fields'] ) ) { $data = array_merge( $data, $contact_cf_data); } ?>


prepare_contact_form( $data, $is_new ) ); ?>
array( 'subscribers.id' ), 'conditions'=> $advanced_filter, 'return_sql'=> true, ); $condition = $query_obj->run($query_args); array_push($query, 'id IN ( ' . $condition . ' )'); $add_where_clause = true; } // Prepare filter by list query if ( ! empty( $filter_by_list_id ) || ! empty( $filter_by_status ) ) { $add_where_clause = true; $filter_sql = "SELECT contact_id FROM {$lists_contacts_table}"; $list_filter_sql = ''; $where_clause_added = false; if ( ! empty( $filter_by_list_id ) ) { $list_filter_sql = $wpbd->prepare( ' WHERE list_id = %d', $filter_by_list_id ); $where_clause_added = true; } if ( ! empty( $filter_by_status ) ) { $list_filter_sql .= ( $where_clause_added ) ? ' AND ' : ' WHERE'; if ( 'soft_bounced' === $filter_by_status ) { $list_filter_sql .= $wpbd->prepare( ' bounce_status = %s', 1 ); } elseif ( 'hard_bounced' === $filter_by_status ) { $list_filter_sql .= $wpbd->prepare( ' bounce_status = %s', 2 ); } else { $list_filter_sql .= $wpbd->prepare( ' status = %s', $filter_by_status ); } } $filter_sql .= $list_filter_sql; $query[] = "id IN ( $filter_sql )"; } // Prepare search query if ( ! empty( $search ) ) { $query[] = ' ( first_name LIKE %s OR last_name LIKE %s OR email LIKE %s ) '; $args[] = '%' . $wpbd->esc_like( $search ) . '%'; $args[] = '%' . $wpbd->esc_like( $search ) . '%'; $args[] = '%' . $wpbd->esc_like( $search ) . '%'; } if ( $add_where_clause || count( $query ) > 0 ) { $sql .= ' WHERE '; if ( count( $query ) > 0 ) { $sql .= implode( ' AND ', $query ); if ( ! empty( $args ) ) { $sql = $wpbd->prepare( $sql, $args ); } } } if ( ! $do_count_only ) { // Prepare Order by clause $order = ! empty( $order ) ? strtolower( $order ) : 'desc'; $expected_order_values = array( 'asc', 'desc' ); if ( ! in_array( $order, $expected_order_values ) ) { $order = 'desc'; } $offset = ( $page_number - 1 ) * $per_page; $expected_order_by_values = array( 'name', 'email', 'created_at', 'first_name' ); if ( ! in_array( $order_by, $expected_order_by_values ) ) { $order_by = 'created_at'; } $order_by = esc_sql( $order_by ); $order_by_clause = " ORDER BY {$order_by} {$order}"; $sql .= $order_by_clause; $sql .= " LIMIT {$offset}, {$per_page}"; $cache_key = ES_Cache::generate_key( $sql ); $exists_in_cache = ES_Cache::is_exists( $cache_key, 'query' ); if ( ! $exists_in_cache ) { $result = $wpbd->get_results( $sql, 'ARRAY_A' ); ES_Cache::set( $cache_key, $result, 'query' ); } else { $result = ES_Cache::get( $cache_key, 'query' ); } } else { $cache_key = ES_Cache::generate_key( $sql ); $exists_in_cache = ES_Cache::is_exists( $cache_key, 'query' ); if ( ! $exists_in_cache ) { $result = $wpbd->get_var( $sql ); ES_Cache::set( $cache_key, $result, 'query' ); } else { $result = ES_Cache::get( $cache_key, 'query' ); } } return $result; } public function prepare_contact_form( $data = array(), $is_new = false ) { $id = ! empty( $data['id'] ) ? $data['id'] : ''; $created = ! empty( $data['created'] ) ? $data['created'] : ''; $guid = ! empty( $data['guid'] ) ? $data['guid'] : ''; $action = ! empty( $data['action'] ) ? $data['action'] : '#'; $first_name = ! empty( $data['first_name'] ) ? $data['first_name'] : ''; $last_name = ! empty( $data['last_name'] ) ? $data['last_name'] : ''; $email = ! empty( $data['email'] ) ? $data['email'] : ''; $send_welcome_email = ! empty( $data['send_welcome_email'] ) ? true : false; $lists_id_name_map = ES()->lists_db->get_list_id_name_map(); if ( count( $lists_id_name_map ) ) { // $list_html = ES_Shortcode::prepare_lists_checkboxes( $lists_id_name_map, array_keys( $lists_id_name_map ), 4, $selected_list_ids, $id, 'contact_data[lists][]' ); $list_html = $this->prepare_lists_html( $id ); } else { $list_html = "" . __( 'No list found', 'email-subscribers' ) . ''; } ?>

get_lists_to_show( $item['id'] ); case 'created_at': return ig_es_format_date_time( $item[ $column_name ] ); case 'first_name': case 'email': default: $column_data = isset( $item[ $column_name ] ) ? $item[ $column_name ] : '-'; return apply_filters( 'ig_es_contact_column_data', $column_data, $column_name, $item, $this ); } } /** * Prepare lists html to set status * * @param int $contact_id * @param int $columns * * @return string * * @since 4.3.6 */ public function prepare_lists_html( $contact_id = 0, $columns = 2 ) { $lists = ES()->lists_db->get_id_name_map(); $lists_html = ''; if ( count( $lists ) > 0 ) { $list_contact_status_map = array(); if ( ! empty( $contact_id ) ) { $list_contact_status_map = ES()->lists_contacts_db->get_list_contact_status_map( $contact_id ); } $lists_html = ""; $i = 0; foreach ( $lists as $list_id => $list_name ) { if ( 0 != $i && 0 === ( $i % $columns ) ) { $lists_html .= ""; } $selected = ! empty( $list_contact_status_map[ $list_id ] ) ? $list_contact_status_map[ $list_id ] : ''; $status_dropdown_html = ''; $status_span = ''; if ( ! empty( $list_contact_status_map[ $list_id ] ) ) { $status_span = ''; } $list_title = $list_name; $list_name = strlen( $list_name ) > 15 ? substr( $list_name, 0, 15 ) . '...' : $list_name; $lists_html .= ""; $i ++; } $lists_html .= '
$status_span$list_name$status_dropdown_html
'; } return $lists_html; } /** * Show lists with it's status * * @param $contact_id * * @return string * * @since 4.0.0 */ public function get_lists_to_show( $contact_id ) { $list_str = ''; if ( isset( $this->contact_lists_statuses[ $contact_id ] ) ) { $lists = $this->contact_lists_statuses[ $contact_id ]; if ( count( $lists ) > 0 ) { // Show only 4 lists // $contact_lists_to_display = array_slice( $lists, 0, 4 ); foreach ( $lists as $list_id => $status ) { if ( ! empty( $this->lists_id_name_map[ $list_id ] ) ) { $list_str .= '' . $this->lists_id_name_map[ $list_id ] . ''; } } } } return $list_str; } /** * Render the bulk edit checkbox * * @param array $item * * @return string * * @since 4.0.0 */ public function column_cb( $item ) { return sprintf( '', $item['id'] ); } /** * Method for subscriber column * * @param array $item an array of DB data * * @return string * * @since 4.8.3 */ public function column_subscriber( $item ) { $delete_nonce = wp_create_nonce( 'ig_es_delete_subscriber' ); $contact_id = $item['id']; $name = ES_Common::prepare_name_from_first_name_last_name( $item['first_name'], $item['last_name'] ); $title = ''; if ( ! empty( $name ) ) { $title = '' . $name . '
'; } $title .= $item['email']; $title = apply_filters( 'ig_es_contact_column_subscriber', $title, $item ); $page = ig_es_get_request_data( 'page' ); $actions = array( 'edit' => '' . esc_html__( 'Edit', 'email-subscribers' ) . '', 'delete' => '' . esc_html__( 'Delete', 'email-subscribers' ) . '', ); if ( isset( $this->contact_lists_statuses[ $contact_id ] ) ) { $lists_statuses = $this->contact_lists_statuses[ $contact_id ]; if ( ! empty( $lists_statuses ) ) { $has_unconfirmed_status = false; foreach ( $lists_statuses as $list_status ) { if ( 'unconfirmed' === $list_status ) { $has_unconfirmed_status = true; break; } } // Show resend confirmation email option only when contact has unconfirmed status in atleast one list. if ( $has_unconfirmed_status ) { $actions['resend'] = '' . esc_html__( 'Resend Confirmation', 'email-subscribers' ) . ''; } } } return $title . $this->row_actions( $actions ); } /** * Associative array of columns * * @return array * * @since 4.0.0 */ public function get_columns() { $columns = array( 'cb' => '', 'subscriber' => __( 'Contact', 'email-subscribers' ), 'lists' => __( 'List(s)', 'email-subscribers' ), 'created_at' => __( 'Created', 'email-subscribers' ) ); return $columns; } /** * Columns to make sortable. * * @return array * * @since 4.0.0 */ public function get_sortable_columns() { $sortable_columns = array( 'name' => array( 'first_name', true ), 'email' => array( 'email', false ), // 'status' => array( 'status', false ), 'created_at' => array( 'created_at', false ), ); return $sortable_columns; } /** * Returns an associative array containing the bulk action * * @return array * * @since 4.0.0 */ public function get_bulk_actions() { $actions = array( 'bulk_delete' => __( 'Delete', 'email-subscribers' ), 'bulk_list_update' => __( 'Move to list', 'email-subscribers' ), 'bulk_list_add' => __( 'Add to list', 'email-subscribers' ), 'bulk_status_update' => __( 'Change status', 'email-subscribers' ), ); $bulk_actions = apply_filters( 'ig_es_contacts_bulk_action', $actions ); return $bulk_actions; } /** * Prepare search box * * @param string $text * @param string $input_id * * @since 4.0.0 * @since 4.3.4 Added esc_attr() */ public function search_box( $text = '', $input_id = '' ) { ?> is_pro() ) { ?> _column_headers = $this->get_column_info(); /** Process bulk action */ $this->process_bulk_action(); $this->search_box( ig_es_get_request_data( 's' ), 'subscriber-search-input' ); $per_page = $this->get_items_per_page( self::$option_per_page, 200 ); $current_page = $this->get_pagenum(); $total_items = $this->get_subscribers( 0, 0, true ); $this->set_pagination_args( array( 'total_items' => $total_items, // WE have to calculate the total number of items 'per_page' => $per_page, // WE have to determine how many items to show on a page ) ); $contacts = $this->get_subscribers( $per_page, $current_page ); $this->items = $contacts; if ( count( $contacts ) > 0 ) { $contact_ids = array_map( array( $this, 'get_contact_id' ), $contacts ); $contact_lists_statuses = ES()->lists_contacts_db->get_list_status_by_contact_ids( $contact_ids ); $this->contact_lists_statuses = $contact_lists_statuses; $this->lists_id_name_map = ES()->lists_db->get_list_id_name_map(); $this->items_data = apply_filters( 'ig_es_subscribers_add_col_data', array(), $contact_ids ); } } /** * Prepare list dropdown * * @since 4.0.0 */ public function prepare_lists_dropdown() { $data = ''; $allowedtags = ig_es_allowed_html_tags_in_esc(); echo wp_kses( $data, $allowedtags ); } /** * Edit Status * * @since 4.0.0 */ public function prepare_statuses_dropdown() { $data = ''; $allowedtags = ig_es_allowed_html_tags_in_esc(); echo wp_kses( $data, $allowedtags ); } /** * Process Bulk Action * * @since 4.0.0 */ public function process_bulk_action( $return_response = false ) { $current_action = $this->current_action(); $response = array( 'status' => 'error', ); // Detect when a bulk action is being triggered... if ( 'delete' === $current_action ) { // In our file that handles the request, verify the nonce. $nonce = esc_attr( ig_es_get_request_data( '_wpnonce' ) ); if ( ! wp_verify_nonce( $nonce, 'ig_es_delete_subscriber' ) ) { die( 'You do not have a permission to delete contact(s)' ); } else { $subscriber_id = absint( ig_es_get_request_data( 'subscriber' ) ); $deleted = ES()->contacts_db->delete_contacts_by_ids( array( $subscriber_id ) ); if ( $deleted ) { $message = __( 'Contact(s) deleted successfully!', 'email-subscribers' ); ES_Common::show_message( $message, 'success' ); } return; } } if ( 'resend' === $current_action ) { // In our file that handles the request, verify the nonce. $nonce = esc_attr( ig_es_get_request_data( '_wpnonce' ) ); if ( ! wp_verify_nonce( $nonce, 'ig_es_delete_subscriber' ) ) { die( esc_html__( 'You do not have a permission to resend email confirmation', 'email-subscribers' ) ); } else { $id = absint( ig_es_get_request_data( 'subscriber' ) ); $resend = ig_es_get_request_data( 'resend', false ); $subscriber = ES()->contacts_db->get_by_id( $id ); $email = $subscriber['email']; $merge_tags = array( 'contact_id' => $subscriber['id'], ); if ( $resend ) { $message = __( 'Confirmation email sent successfully!', 'email-subscribers' ); ES_Common::show_message( $message, 'success' ); return; } else { $response = ES()->mailer->send_double_optin_email( $email, $merge_tags ); $url = add_query_arg( 'resend', true ); // redirect to resend link and avoid resending email ?> contacts_db->delete_contacts_by_ids( $subscriber_ids ); if ( $deleted ) { $message = __( 'Contact(s) deleted successfully!', 'email-subscribers' ); if ( ! $return_response ) { ES_Common::show_message( $message, 'success' ); } $response['status'] = 'success'; $response['message'] = $message; $response['errortype'] = false; } return $response; } if ( ( 'bulk_status_update' === $action ) || ( 'bulk_status_update' === $action2 ) ) { $status = ig_es_get_request_data( 'status_select' ); if ( empty( $status ) ) { $message = __( 'Please select status.', 'email-subscribers' ); if ( ! $return_response ) { ES_Common::show_message( $message, 'error' ); } $response['status'] = 'error'; $response['message'] = $message; $response['errortype'] = false; return $response; } // loop over the array of record IDs and delete them $edited = ES()->lists_contacts_db->edit_subscriber_status( $subscriber_ids, $status ); if ( in_array( $status, array( 'unsubscribed', 'unconfirmed' ), true ) ) { do_action( 'ig_es_admin_contact_unsubscribe', $subscriber_ids ); } if ( $edited ) { $message = __( 'Contact(s) status changed successfully!', 'email-subscribers' ); if ( ! $return_response ) { ES_Common::show_message( $message, 'success' ); } $response['status'] = 'success'; $response['message'] = $message; $response['errortype'] = false; return $response; } return; } if ( ( 'bulk_list_update' === $action ) || ( 'bulk_list_update' === $action2 ) ) { $list_id = ig_es_get_request_data( 'list_id' ); if ( empty( $list_id ) ) { $message = __( 'Please select list.', 'email-subscribers' ); if ( ! $return_response ) { ES_Common::show_message( $message, 'error' ); } $response['status'] = 'error'; $response['message'] = $message; $response['errortype'] = false; return $response; } $edited = ES()->lists_contacts_db->move_contacts_to_list( $subscriber_ids, $list_id ); if ( $edited ) { $message = __( 'Contact(s) moved to list successfully!', 'email-subscribers' ); if ( ! $return_response ) { ES_Common::show_message( $message, 'success' ); } $response['status'] = 'success'; $response['message'] = $message; $response['errortype'] = false; return $response; } return; } if ( ( 'bulk_list_add' === $action ) || ( 'bulk_list_add' === $action2 ) ) { $list_id = ig_es_get_request_data( 'list_id' ); if ( empty( $list_id ) ) { $message = __( 'Please select list.', 'email-subscribers' ); if ( ! $return_response ) { ES_Common::show_message( $message, 'error' ); } $response['status'] = 'error'; $response['message'] = $message; $response['errortype'] = false; return $response; } $edited = ES()->lists_contacts_db->add_contacts_to_list( $subscriber_ids, $list_id ); if ( $edited ) { $message = __( 'Contact(s) added to list successfully!', 'email-subscribers' ); if ( ! $return_response ) { ES_Common::show_message( $message, 'success' ); } $response['status'] = 'success'; $response['message'] = $message; $response['errortype'] = false; return $response; } } if ( 'bulk_send_confirmation_email' === $current_action ) { $response = Email_Subscribers_Pro::handle_bulk_send_confirmation_email_action( $subscriber_ids, $return_response ); return $response; } } } /** * Set form_id = 0 as Form is already deleted * * @param $form_id * * @since 4.3.1 */ public function set_default_form_id( $form_id ) { global $wpdb; $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}ig_contacts SET form_id = %d WHERE form_id = %d", 0, $form_id ) ); } }