function save() { if (isset($_POST['delete-this-user']) && $_POST['delete-this-user'] == 'yes') { SendPress_Data::delete_subscriber($_POST['subscriberID']); if ($_GET['listID']) { SendPress_Admin::redirect('Subscribers_Subscribers', array('listID' => $_GET['listID'])); } else { SendPress_Admin::redirect('Subscribers_All'); } } else { global $post; $subscriber_info = array('email' => $_POST['email'], 'firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname']); SendPress_Data::update_subscriber($_POST['subscriberID'], $subscriber_info); $args = array('post_type' => 'sendpress_list', 'post_status' => array('publish', 'draft'), 'posts_per_page' => 100, 'order' => 'ASC', 'orderby' => 'title'); $postslist = get_posts($args); foreach ($postslist as $post) { setup_postdata($post); if (isset($_POST[$post->ID . "-status"]) && $_POST[$post->ID . "-status"] > 0) { SendPress_Data::update_subscriber_status($post->ID, $_POST['subscriberID'], $_POST[$post->ID . "-status"]); } else { SendPress_Data::remove_subscriber_status($post->ID, $_POST['subscriberID']); } $notifications = SendPress_Data::get_post_notification_types(); if (isset($_POST[$post->ID . "-pn"]) && array_key_exists($_POST[$post->ID . "-pn"], $notifications)) { SendPress_Data::update_subscriber_meta($_POST['subscriberID'], 'post_notifications', $_POST[$post->ID . "-pn"], $post->ID); } } wp_reset_postdata(); } SendPress_Admin::redirect('Subscribers_Subscriber', array('subscriberID' => $_POST['subscriberID'])); }
static function delete_subscribers_bulk_all() { if (isset($_GET['subscriber']) && is_array($_GET['subscriber'])) { foreach ($_GET['subscriber'] as $value) { SendPress_Data::delete_subscriber($value); } } SendPress_Admin::redirect('Subscribers_All'); }