I’ve created a custom login box. I’m using wp_signon()
method. Everything works well.
Also i have a Remember me checkbox so i can remember user credentials next time. I know i can do it my own way of handling cookies but i want know is there any wordpress builtin method to get cookies.
This is my code so far:
$creds['user_login'] = $user_login;
$creds['user_password'] = $user_pass;
$creds['remember'] = ($remember_me === "true") ? true : false;
$user = wp_signon( $creds, false );
I can see auth
cookies on Firebug Cookies tab but they are appended with hashes. How can i decrypt them or any safer method to get cookies. I’ve also seen in utils.js
and there are some methods to get and set cookies but it only gets plain text cookies. (Correct me if iam wrong).
Simply i want the data that WordPress has stored in the cookies when logged in. After logout and return to my login box it can fill my login box with username and password (Like wordpress default login page).
if you are logged in
wp_parse_auth_cookie(LOGGED_IN_COOKIE);
will return array consisting wp user name, cookie hash and expiration time. This function will return null if you are not logged in. But you cannot get plain password as wordpress doesn’t store plain password.