logged_in user outside of wordpress loop
I have a member site which maintains a collection of books. I want to have a page on a folder outside of my loop that can see if the user is logged in to the main site, and then display the book viewer. If the user is not logged in to the main site, display a different page. I think I am having some trouble with cookies. I installed the Root Cookie Plugin, to help
This is the code I've put together, what needs to be done better:
?php
define('WP_USE_THEMES', false);
if (file_exists('../books/wp-blog-header.php')) {
require_once('../books/wp-blog-header.php');
} else {
echo 'ERROR: blog header does not exist';
}
global $current_user;
get_currentuserinfo();
// Start Site
$sitetitle = 'Book Viewer';
include 'head.php';
if ($current_user-ID == 0)
{
include ('guest.php');
exit;
}
else
{
include ('viewer.php');
}
include 'foot.php';
?
Should I be using wp-load.php
instead of wp-blog-header
or do I need to do something with wp_signon
Topic outside-wordpress users Wordpress
Category Web