0 && user_can( $uid, 'manage_options' ); } /** * The user id proven by the logged-in cookie, or 0. The cookie is verified * (`wp_validate_auth_cookie()` checks the HMAC and the session token), so a forged * one buys nothing but its own exclusion from the log. * * @return int */ private static function user_id_from_cookie() { // A crawler — and every logged-out visitor — sends no such cookie: the cheap exit, // taken on essentially every request that this log exists to record. if ( ! defined( 'LOGGED_IN_COOKIE' ) || empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) { return 0; } $cookie = wp_unslash( $_COOKIE[ LOGGED_IN_COOKIE ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- verified by wp_validate_auth_cookie() below; never stored or output. return (int) wp_validate_auth_cookie( $cookie, 'logged_in' ); } }