Check for login outside WordPress
-
Hi,
I’ve read some posts and did some fiddling but I can’t seem to get things going. I’m integrating WP into an existing webpage and from that page I’m trying to check on when a user is logged in.
I’m using the following code.
<?php global $user_ID; get_currentuserinfo();
if ($user_ID)
{
echo "logged in";
}
else
{
echo "logged out";
}
?>
When I use this in sidebar.php to test it it works fine, but on my test page it does not.
What am I missing? I have the
<?php $blog = 1; require('wordpress/wp-blog-header.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
at the top of the page.
- The topic ‘Check for login outside WordPress’ is closed to new replies.