I use FaceBook JS SDK to check whether the user has permission to log in to my site or not. If user has permission I log him into the WP site.
It is possible to check with JS whether the user already logged in or not? Possible to check existance of wordpress_logged_in_
cookie, and how?
I am trying with this code, but doesn’t work:
if (document.cookie.search(/^wordpress_logged_in_w*/) >= 0) {
// Cookei exsist.
alert("Cookie");
}
thanks,
Just use
wp_localize_script()
andis_user_logged_in()
.A bit of PHP can make it a whole lot easier.
It will work in wordpress 2.0.0+