• Other posts on this subject are not really resolved or are old…
    I currently have a legacy site that uses phpbb as a support forum with site-wide authorization and status. The site itself has many sub directories and pages i am thinking of installing a fresh wp install with bbpress and getting rid of the phpbb alltogether. I would like to have the same functionality across all the pages in the site as loged in users are delivered different content on different pages. With phpbb i use a function on pages like this one for a page in the root other directories just change root path to phpbb

    define('IN_PHPBB', true);
    $phpbb_root_path = './forum/';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);
    
    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup();
    
    if(isset($_POST['login']))
    {
        $username = request_var('username', '', true);
        $password = request_var('password', '', true);
        $autologin = (!empty($_POST['autologin'])) ? true : false;
    
        $result = $auth->login($username, $password, $autologin);
    
        if ($result['status'] == LOGIN_SUCCESS)
        {
            //User was successfully logged into phpBB
            // append/replace SID
            $redirect = reapply_sid('curPageURL()');
    
            meta_refresh(0, $redirect);
        }
        else
        {
            $badlogin = 'bad';
        }
    }
    if (isset($_GET['logout'])) {
    	$user->session_kill();
    	$user->session_begin();
    	$redirect = request_var('redirect', "index.$phpEx");
    	redirect($redirect);
    }

    Looking if anyone has done this with WordPress and what i might need to do. I know I will have to define cookie path but what else am i getting into any help would be greatly appreciated

    Thanks Chuck

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You can simply use is_user_logged_in() to determine if a user is logged in. Based on that you can redirect ( with wp_redirect() ) to whatever was in the user’s cookie or go to the login or registration page.

Viewing 1 replies (of 1 total)
  • The topic ‘Sessions and login status non wordpress pages’ is closed to new replies.