Welcome Guest, Not a member yet? Register   Sign In
phpBB bridge: Having incredible difficulty making it work.
#1

[eluser]Zero-10[/eluser]
Codeigniter: version 1.7.2
phpBB: version 3.6 RC7
URL Rewrite: default, no rewrite engine. ie: .com/index.php/home/

I would like to begin to explain that I have been working on this problem for approximately 17 hours and am at an all-time high in frustration with this. I have searched these forums and tried a lot of different approaches to this problem and have yielded no success.

I believe the most prominent example that is used throughout this forum as well as Google is http://codeigniter.com/wiki/phpBB3_library/

However when I follow this guide I come to find that whatever my directory structure is, I get an object error. Though outside of codeigniter, I can make the bridge work by using a non-codeigniter script.

The Error message that I am receiving is from the official code from the codeigniter wiki is:
Code:
Fatal error: Call to a member function on a non-object in /homepages/XX/XXXXXXXXXX/htdocs/mysite/mydirectory/system/application/views/testing.php on line 8


on line 8 I see:
Code:
$user->session_begin();

When I verify in my config file, I see that the database is perfectly fine, hence why my custom CMS is working and both DB_Session and init_db_session are in the library folder. I believe I had figured this one out about a month ago when I first started playing with codeigniter and received a different error message about functions/commons.php if I remember correctly.

The code in full for the test view page is:
Code:
<?php
define('IN_PHPBB', true);
$phpbb_root_path = "<?=$base_uri ?>../../../afolder/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($user->data['is_registered']){
   echo ("You are logged in!");
}
else{
   echo ("You are not logged in!");
}

?>

<html><body>

<a href="../../../afolder/forum/">to the forum!</a>

&lt;/body&gt;&lt;/html>

I am not entirely sure where I am going wrong, perhaps it really is the session that is wrong. I would also like to point out that any function with public in front of it doesn't work on my server for some reason. So when I delete public it works. I tried it with this bridge but it didn't make any difference. I'm going to keep working on it until I get it! So please, any help would be great! Just remember that I have did all that I can to search for help already and this is my last resort :'( Thank you!
#2

[eluser]WebsiteDuck[/eluser]
What does your controller look like?
#3

[eluser]Zero-10[/eluser]
[quote author="WebsiteDuck" date="1263120209"]What does your controller look like?[/quote]

It's loading the view file which the viewfile contains what was mentioned above. I don't remember if I had anything in my controller other than that. <b><i>edit: before I tried a few new things recently</b></i> The database is loaded through the autoload function, though my phpbb tables are not. They are both on the same db but phpbb has the phpbb_ suffix while my CMS has mycmsname_tablename. This might be why I'm getting so confused? Or perhaps it's the lack of information in the controller. At any rate, I don't believe posts such as: http://ellislab.com/forums/viewthread/125350/P0/ even included info on what to put in a controller.

Please let me know what you think.

-Zero
#4

[eluser]Tweakin[/eluser]
I've just recently started a project that is making use of phpBB integration. We are using the phpbb_library as a base and extending upon it to better fit our needs.

Try this example controller, it should work with phpbb_library out of the box.

Code:
class Sample extends Controller
{
    public function __construct()
    {
        parent::Controller();
        $this->load->database();
        $this->load->library('session');
        $this->load->library('phpbb_library');
    }
    
    public function index()
    {
        if ($this->phpbb_library->isLoggedIn() === TRUE)
        {
            echo 'You are logged in.';
        }
        else
        {
            echo 'You are not logged in.';
        }
    }
}

You do have to manually edit the phpbb_library constructor to ensure it is pointing to your forum's correct path (path not url).

Table prefixes should not matter for what you are doing. Having the site/forums on separate database will require a few tweaks, but it sounds like you have them both in one database.
#5

[eluser]Zero-10[/eluser]
Thank you Tweakin for that response! It guided me to I think the right direction however when I do that (I started the bridge functions from scratch to avoid any errors) I get

Code:
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /homepages/XX/XXXXXXX/htdocs/site/codeigniterfolder/system/application/controllers/sekaibridge.php on line 4

Line 4:
Code:
public function __construct()

When i remove public I get the following error message:
Code:
Fatal error: Call to a member function on a non-object in /homepages/XX/XXXXXXX/htdocs/site/codeigniterfolder/system/application/controllers/sekaibridge.php on line 14

Line 14:
Code:
if ($this->phpbb_library->isLoggedIn() === TRUE)

When I open php_library (it is at default except the directory structure) Line 77:
Code:
public function isLoggedIn()
    {
        return $this->_user->data['is_registered'];
    }

I did notice that in the comment it talked about boolean so I changed my config's bool to TRUE but it did nothing. Also my server doesn't support url-rewrite. Any further suggestions?

Additonal inforomation about my directory structure:
mysite.com/codeigniterdir/index.php/sekaibridge/ (controller file)
mysite.com/community/forumdir/ (root of my forums)
#6

[eluser]Tweakin[/eluser]
Well nothing you have mentioned so far means phpbb_library would not work. I would suggest not trying to work around anything, instead just do everything as it is intended and only change the value of the path to your forums in phpbb_library's constructor.

Make a controller exactly like the one I wrote above, call it sample.php. Add phpbb_library.php to your /application/libraries/ folder.

Change this line:

Code:
public function __construct()
{
    //....
    define('FORUM_ROOT_PATH', '/path/to/your/phpbb3/installation/');
    //....
}

To the real path of your forums, starting from your file root. Given what you wrote, it would be something like /homepages/XX/XXXXXXX/htdocs/forums/.

Then try the controller again.
#7

[eluser]Zero-10[/eluser]
Unfortunately that solution didn't work for me. It had no effect on the error message that I was receiving. I am having someone trying to look over the code since he's pretty good at CI and has gotten it to work for his site but so far no luck, he can't figure out why it's not working either. Tongue
#8

[eluser]Tweakin[/eluser]
Who is your web host? Is your phpBB install sound and vanilla, or do you have plug-ins running? Short of issues with those questions it should work just fine- it would not be a matter of making CI work with the library, as that is it's intended purpose Smile

My bet is an issue with a phpBB file or hosting setup.
#9

[eluser]Zero-10[/eluser]
My hosting should be fine, it's a VPS with most functionality as you'd get with a localhost. Speaking of which, it's been tested on my localmachine and he tested it on his (which works for his site but not mine) so it's very likely that it's a conflicting phpBB error as I have modded my boards inside and out to befit what I needed it to do. Though, the login functions were never modified. Well, we'll keep trying and see what happens. Thank you for your support!




Theme © iAndrew 2016 - Forum software by © MyBB