PhpBB 3.2.2 Twig Loader Error When Using PhpBB For Website Login

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
MunkeeJuice
Registered User
Posts: 1
Joined: Tue Jul 10, 2018 9:36 am

PhpBB 3.2.2 Twig Loader Error When Using PhpBB For Website Login

Post by MunkeeJuice »

I am trying it use the authentication of PhpBB 3.2.2 to authenticate the websites users. I have added the code below to the top of a test page

Code: Select all

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();
This works fine on a standalone page but when i include my own custom bootloader to setup a few things on my website the following warning is thrown
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/template/twig/loader.php on line 176: Declaration of phpbb/template/twig/loader::findTemplate($name) should be compatible with Twig_Loader_Filesystem::findTemplate($name, $throw = true)
From this i assume that PHPBB is setting up a Twig enviroment that appears to be conflicting with the one i have in my own file. This also causes my Twig templates not to load, if the above code is removed my Twig templates load without issue.

So my question is this, is there a way to use the authentication side of PHPBB for my website without it impacting the Twig settings for the rest of the site?
Post Reply

Return to “phpBB Custom Coding”