Example #1
0
function splot_the_author()
{
    // utility to put in template to show status of special logins
    // nothing is printed if there is not current user,
    //   echos (1) if logged in user is the special account
    //   echos (0) if logged in user is the another account
    //   in both cases the code is linked to a logout script
    if (is_user_logged_in() and !current_user_can('edit_others_posts')) {
        $user_code = truwriter_check_user() ? 1 : 0;
        echo '<a href="' . wp_logout_url(site_url()) . '">(' . $user_code . ')</a>';
    }
}
Example #2
0
// ------------------------ defaults ------------------------
// default welcome message
$feedback_msg = '';
// the passcode to enter
$wAccessCode = truwriter_option('accesscode');
// ------------------------ door check -----------------------
// already logged in? go directly to the tool
if (is_user_logged_in()) {
    if (current_user_can('edit_others_posts')) {
        // If user has edit/admin role, send them to the tool
        wp_redirect(site_url() . '/write');
        exit;
    } else {
        // if the correct user found, go directly to the tool
        if (truwriter_check_user()) {
            wp_redirect(site_url() . '/write');
            exit;
        } else {
            // we need to force a click through a logout
            $log_out_warning = true;
            $feedback_msg = 'First, please <a href="' . wp_logout_url(site_url() . '/write') . '" class="pretty-button pretty-button-green">activate lasers</a>';
        }
    }
} elseif ($wAccessCode == '') {
    // no code required, log 'em in
    wp_redirect(site_url() . '/wp-login.php?autologin=writer');
    exit;
}
// ------------------------ presets ------------------------
// verify that a  form was submitted and it passes the nonce check