I need a way to verify that the user has logged into wordpress. Wait before you go saying the stock simpleton answer, this needs to be done from a page external to wordpress but on the same site.
I have a webpage that is external to wordpress. Let's say it's:
http://www.mainsite.com/notes/index.php
But I want to use wordpress as my login system and it's located under
http://www.mainsite.com/wordpress/
PhpBB has this code set in stone but when I go to find a way to do it for WP I get a million different varieties none of which come close. Absolutely mind boggling when I think of how hacked together phpbb is yet they've managed to keep their login system as pure as the driven snow.
So how can I get this done?
I've tried several methods including one that I found on:
http://hungred.com/how-to/tutorial-validate-user-logged-wordpress/
I scraped together some code from the most recent codex found at:
http://codex.wordpress.org/Function_Reference/wp_get_current_user
Here are several codes i've used in fact. None of which amounted to diddly squat.
define('WP_USE_THEMES', false);
require($_SERVER['DOCUMENT_ROOT'] . '/wordpress/wp-blog-header.php');
global $current_user;
wp_get_current_user();
if ( 0 == $current_user->ID ) {
// Not logged in.
echo "not logged in";
} else {
// Logged in.
echo "logged in";
}
Then I tried:
require_once ($_SERVER['DOCUMENT_ROOT'].'/wordpress/wp-config.php');
global $current_user;
get_currentuserinfo();
if ( is_user_logged_in() )
{
echo "i am logged in";
}
I've exhausted all online resources. I suppose wordpress has made so many updates or done perhaps it's one of the various plugins that is vexing me. I have Role-Scoper and Capability Manager activated. I'm to the point where I can no longer think rationally about the problem at hand. Thanks for any advice offered.