• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Clearing the Cookie Jar from External

LPH

Well-known member
#1
An external login relies on the cookies of XenForo and authorizes the cookies via a pluggable WordPress function.

PHP:
function wp_validate_auth_cookie( $cookie = '', $scheme = '' ) {

    $visitor = XenWord::getVisitor();
    $user_id = $visitor['user_id'];

    if ( $user_id !== 0 ) {
        return $user_id;
    }

    return false;
}
This is very slick but I need to figure out how to do clear the cookies on logout.

PHP:
function wp_clear_auth_cookie() {
     // empty because I'm looking at the cookie jar
}

function xenword_cookie_expiration( $expiration, $user_id, $remember ) {
    return $remember ? $expiration : -600;
}

add_filter( 'auth_cookie_expiration', 'xenword_cookie_expiration', 99, 3 );
First, I'm guessing that the wp_clear_auth_cookie() method should mimic the reset() in the cookie jar but only for the particular user. Next, the cookie_expiration should also be for a particular user.