Verify from external page that user has logged into wordpress (1 post)

  1. chazsey
    Posted 4 years ago #

    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:
    But I want to use wordpress as my login system and it's located under

    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:

    I scraped together some code from the most recent codex found at:

    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;
    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;
    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.

Topic Closed

This topic has been closed to new replies.

About this Topic