What would be the best way to display a login info on an HTML page which sits at the same website which is running on WordPress?
Since we're talking about an html page here, I suppose that document.write is the one good way to eventually put that login info on the page; But, how do you find out about the login Status? That's where the real question lies.
Scenario:
You are on an empty index.html file, which, let's say, sits as www.example.com/my-special-app/index.html
And you got a WordPress website running at www.example.com,
And depending on whether the user currently logged-in to the WordPress or not, you want to display:
Welcome Anonymous, [login]
OR
Welcome Joe, [log-out]
on the page, as soon as the user lands on that index.html page.
The page's being an html page makes this difficult to get at, at least in my mind.
If this was a php page ( such as index.php ), I would just use include the wordpress blog header with the load theme option set to false and then use wordpress API's to figure out the login status.
But I've got to deal with an index.html situation, here. The only thing I can think of is to tap into the wordpress authentication cookies, and somehow pull this off using pure JS. But there are cookie hashes, and wordpress authentication cookie is not a guessable one. So there is some complexity there.
As far as I know, the WP cookie-hash uses an md5 like this:
$cookie_hash = md5("http://www.example.com");
Ad the wordpress authentication cookie name then happens to be
$wordpress_logged_in_cookie_name = wordpress_logged_in_'.$cookie_hash;
But is this reliable, is it so, all the time?
Eventually, I will be needing this in an angular Application. ( AngularJS but Angular ) and when the Angular app initializes, I'd like it to move on with the session info at hand and obviously do not require another login for the current user!