How do I intergrate wordpress login with phpbb?

Discussion forum for MOD Writers regarding MOD Development.
Locked
Danielx64
Registered User
Posts: 1369
Joined: Wed Nov 04, 2009 5:51 am
Location: In a server room in Australia
Name: Daniel
Contact:

How do I intergrate wordpress login with phpbb?

Post by Danielx64 »

Hello,

I found this code on this forum:

Code: Select all

<?php
    define('IN_PHPBB', true);
    $phpbb_root_path = './forums/';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);

    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup(); 

    if($user->data['is_registered'])
    {
        echo "Welcome " . $user->data['username']; //User is already logged in
echo "av" . 
		echo '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout', true, $user->session_id). '">Log out</a>'; 
    }
    else 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
            $redirect = request_var('redirect', "{$phpbb_root_path}index.$phpEx");

            // append/replace SID
            $redirect = reapply_sid($redirect);

            meta_refresh(0, $redirect);
            trigger_error('You have been logged in');
        }
        else
        {
            echo 'Bad Login ' . $username; //User's login failed
        }
    }
    else
    {
        echo '
            Please log in:<br />
            <form method="POST" action="./forums/ucp.php?mode=login">
            <p>Username: <input type="text" name="username" size="40"><br />
            Password: <input type="password" name="password" size="40"><br />
            Remember Me?: <input type="checkbox" name="autologin"><br />
            <input type="submit" value="Submit" name="login"></p>
			<input type="hidden" name="redirect" value="../test.php">
            </form>';
    }
    ?>
And when I went to run the webpage, i get this:
Fatal error: Call to a member function sql_query() on a non-object in C:\xampp\htdocs\forums\includes\cache.php on line 51
What I'm trying to do is set it up so that when you login the forum, you would be logged into wordpress and the other way round.

I'm using Wordpress 2.8.6 and PHPBB 3..05

Thanks.

Daniel
Please note that I will not be porting any of my mods to phpBB 3.1. Sorry for the inconvenience this may cause.
Image

User avatar
FreakyBlue
Registered User
Posts: 331
Joined: Sun Jul 27, 2008 6:00 pm
Name: David Jansen
Contact:

Re: How do I intergrate wordpress login with phpbb?

Post by FreakyBlue »

Isn't this what you are looking for: http://www.phpbb.com/community/viewtopi ... =wp+united
My music and tutorials -> https://youtube.com/gh0stwrit3rMusic/
Former phpBB Style and Mod Author -> https://www.phpbb.com/customise/db/auth ... tributions

Danielx64
Registered User
Posts: 1369
Joined: Wed Nov 04, 2009 5:51 am
Location: In a server room in Australia
Name: Daniel
Contact:

Re: How do I intergrate wordpress login with phpbb?

Post by Danielx64 »

FreakyBlue wrote:Isn't this what you are looking for: http://www.phpbb.com/community/viewtopi ... =wp+united
Thankyou for the quick reply. Yes I did see that, however, it looked that the project has stalled. Jhong havn't been on the forum for some time, and his own support forum is not looking good.

I will have a look at it, but I don't know if this going to stay around for much longer

Daniel
Please note that I will not be porting any of my mods to phpBB 3.1. Sorry for the inconvenience this may cause.
Image

Locked

Return to “[3.0.x] MOD Writers Discussion”