$newopts['ad_opt_page_replace'] = $_POST['ad-page-replace'] === 'replace' ? 'true' : 'false';
        //Set option for sitewide lockdown
        $newopts['ad_opt_protect_site'] = isset($_POST['ad-protect-site']) ? 'true' : 'false';
        //Set option for redirecting anonymous users to login if accessing restricted content
        $newopts['ad_opt_login_anon'] = isset($_POST['ad-msg-forcelogin']) ? 'true' : 'false';
        //Update the options array
        $saveStatus = CTXPS_Queries::set_options($newopts);
        //If save was successful, show the message
        if (isset($saveStatus)) {
            $updatesettingsMessage = '<div id="message" class="updated below-h2 fade"><p><strong>' . __('Page Security settings saved.', 'contexture-page-security') . '</strong></p></div>';
        }
    }
}
//Get AD messages from options
$ADMsg = get_option('contexture_ps_options');
$ProtPages = CTXPS_Queries::get_protected_posts();
//wp_die($ProtPages);
//Generate ddls with page heirarchy
$pageDDLAuth = wp_dropdown_pages(array('name' => 'ad-page-auth', 'show_option_none' => __('-- Choose Access Denied Page --', 'contexture-page-security'), 'show_option_none_value' => 0, 'selected' => $ADMsg['ad_page_auth_id'], 'echo' => 0, 'exclude' => $ProtPages));
$pageDDLAnon = wp_dropdown_pages(array('name' => 'ad-page-anon', 'show_option_none' => __('-- Choose Access Denied Page --', 'contexture-page-security'), 'show_option_none_value' => 0, 'selected' => $ADMsg['ad_page_anon_id'], 'echo' => 0, 'exclude' => $ProtPages));
//If there aren't any pages that can be used for AD, replace with this helpful message
if (empty($pageDDLAuth)) {
    $pageDDLAuth = sprintf(__('No available pages were found. <a href="%s">Add Page</a>', 'contexture-page-security'), admin_url('post-new.php?post_type=page'));
} else {
    //Only show edit button if something is already selected
    if (!empty($ADMsg['ad_page_anon_id'])) {
        $pageDDLAuth .= sprintf('<a href="%s">%s</a> | ', admin_url('post.php?post=' . $ADMsg['ad_page_auth_id'] . '&action=edit'), __('Edit Page'));
    }
    //Add an "Add Page" button...
    $pageDDLAuth .= sprintf('<a href="%s">%s</a>', admin_url('post-new.php?post_type=page'), __('Add Page'));
}