1 – Introduction
This post gives you several suggestions to fully integrate PHPBB forum with your custom web pages.
I spent a lot of time on the PHPBB (v2.x and v3.x) integration cause I did it for one of my websites: www.pescasubacquea.net (one of the most important spearfishing communities in Italy). I think it could be useful to share this experience by using some examples.
2 – Session integration
The most important step to integrate PHPBB with existing web pages is to include that pages in the PHPBB user session; in this way, we are able to understand whether the user has logged successfully in PHPBB or not and, just in the case it’s logged in, use the session variables for our purposes.
To include a page in the PHPBB user session you need to add the following code at the top of your page:
PHPBB3
<?
define('IN_PHPBB', true);
$phpEx = 'php';
$phpbb_root_path = '<Absolute path to your PHPBB forum folder>';
include_once($phpbb_root_path . 'config.'.$phpEx);
include_once($phpbb_root_path . 'common.'.$phpEx);
$user->session_begin();
$auth->acl($user->data);
?>
PHPBB2
<?
define('IN_PHPBB', true);
$phpbb_root_path = '<Absolute path to your PHPBB forum folder>';
include_once($phpbb_root_path . 'extension.inc');
include_once($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
?>
Read the rest of this entry »