Support » Networking WordPress » Auto Login/Logout

  • I’ve added wordpress as a folder into another site that requires members to login. Rather than force them to login again to the blog I’ve added the following code to the index.php page of the blog to automatically log them in if they’ve logged into the membership site:

    if (!is_user_logged_in()) {
    $user_info = get_user_by($field, $_SESSION[SESS_USERNAME]);
    $user_login = $user_info->user_login;
    $user_level = $user_info->user_level;
    $user_id = $user_info->ID;
    do_action(‘wp_signon’, $user_id);

    It works well and now I’m trying to automatically log them out from the blog when they logout from the memerbship site using the code:

    if ( is_user_logged_in() )
    else echo “Blog User is Not Signed In.”;

    The problem I’m having is that the is_user_logged_in fuction always returns false, even when the blog is statig that I’m logged in.

    does anyone have experience with a similar solution?

    Thanx ….. Rick

  • The topic ‘Auto Login/Logout’ is closed to new replies.