Advertisements

wp_authenticate_cookie

Definition:
function wp_authenticate_cookie($user, $username, $password) {}

Authenticate the user using the WordPress auth cookie.

Parameters

  • $user
  • $username
  • $password

Source code

function wp_authenticate_cookie($user, $username, $password) {

	if ( is_a($user, 'WP_User') ) { return $user; }



	if ( empty($username) && empty($password) ) {

		$user_id = wp_validate_auth_cookie();

		if ( $user_id )

			return new WP_User($user_id);



		global $auth_secure_cookie;



		if ( $auth_secure_cookie )

			$auth_cookie = SECURE_AUTH_COOKIE;

		else

			$auth_cookie = AUTH_COOKIE;



		if ( !empty($_COOKIE[$auth_cookie]) )

			return new WP_Error('expired_session', __('Please log in again.'));



		// If the cookie is not set, be silent.

	}



	return $user;

}

3429

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: