static function manage_optout() { global $wpdb; $post = stripslashes_deep($_POST); if (isset($post['button_add']) && $post['button_add'] == 'Add') { // add an email address to the excludes list $email = $post['email_address']; // make sure it is a valid email address if (!is_email($email)) { wp_redirect('admin.php?page=followup-emails-optouts&error=' . urlencode(__('The email address is invalid', 'follow_up_emails'))); exit; } FUE::exclude_email_address($email); wp_redirect('admin.php?page=followup-emails-optouts&added=' . urlencode($email)); exit; } elseif (isset($post['button_restore']) && $post['button_restore'] == 'Apply') { $emails = $post['email']; $email_ids = ''; if (is_array($emails) && !empty($emails)) { $email_ids = "'" . implode("','", $emails) . "'"; } if (!empty($email_ids)) { $wpdb->query("DELETE FROM {$wpdb->prefix}followup_email_excludes WHERE id IN({$email_ids})"); } wp_redirect('admin.php?page=followup-emails-optouts&restored=' . count($emails)); exit; } wp_redirect('admin.php?page=followup-emails-optouts'); exit; }