How to connect to external database using phpBB db classes

This is the simply way to connect to an external database in phpBB (we go to use mysql lib here, but you could use another of these available in /phpbb32/phpbb/db/driver folder changing namespace (if on php7> you need to use mysqli and NOT mysql or you’ll get error) using phpBB db classes

This is it.

Note: if on Php7 > change line

$phpbb_c = new \phpbb\db\driver\mysql();
$phpbb_c = new \phpbb\db\driver\mysqli();

to switch and use mysqli.

WP_w3all for WordPress MS MU (Multisite, Multiuser network installations)

To configure WP_w3all on WordPress MS MU please read all the follow:

WP_w3ll plugin from 1.7.0 – WordPress MU MS  . The plugin can be also network activated, but the linked phpBB on each subsite, need to be the same (same path and same url setting value). If plugin is network activated, it is mandatory that the sub admin or super admin, setup/configure  into (each) subsite the same config of the main site for the integration plugin, because if not, when an user login into a subsite where the plugin is not configured, the phpBB cookie will not be released, and when same logged user visit the main site or another subsite where the plugin run instead configured, the user will be logged out. Registered phpBB users are added as users only into the FIRST WP site (or subsite) where users will login or that they will visits while coming already logged in into phpBB. *But you could use a plugin to add coming phpBB logged users, into each or just few WordPress site/subsites they visits, see more below.

NOTE: from 1.9.0 patched at date of this post ( or from 1.9.0 > ) it is NOT more necessary to execute this step editing the wp-config.php file
but check an hint and a warning more for WP mums installations more below on this same post.

OPEN wp-config.php file:

search for line (value wp_ can be maybe different):

immediately after ADD:


BEWARE that if a different phpBB is linked on subsites, the integration in this state lead to unpredictable results! … in true it is very predictable what can happen, but really long to explain and too hard for my Eng! In short, it is NOT possible to link a different phpBB into WP network subsites with actual code.
Setup into sub-sites, if the plugin is network activated, same path and url in WP_w3all config, with same values of main site.

*Hint: you could use a plugin to add coming phpBB logged users, into each WordPress they visits, or just to few, and with several different features:  search for Join My Multisite plugin at WordPress plugins directory.

NOTE: WP_w3all phpBB integration plugin when an user is deleted in WordPress (so it become deactivated in phpBB, and then you may go to delete this user in phpBB) also clean up from signup table in WordPress this user. This is necessary for compatibility (as the code is) with phpBB integration to avoid that another user register with same email into phpBB (if you allow users to register also on phpBB side, and you have also deleted this user also in phpBB) while the user has been deleted in WP, but his email/username remain stored into WP database signups table for some more time.

WP_w3all overall_footer.html for iframe JS/Ajax: PM on address bar and right click/copy links


follow the new iframe v3 template procedure


Since 1.7.2, follow iframe  instructions installation:

Embed phpBB into WordPress template:iframe responsive how to

WP_w3all .htaccess and Javascript for phpBB: rewrite URLs to point iframe how to (Spiders friendly)

Open .htaccess file of your phpBB root folder, search for this line:

just below add the follow:

Change on lines

RewriteRule . /yourwp/index.php/forum/?%3post_id=%5%6 [R,L]


RewriteRule . /yourwp/index.php/forum/?%3 [R,L]

the relative iframe URL that need to point to your correct WP forum page (leave index.php in place).

To help understand, this is the correct .htaccess code for this online working example:

WP page forum URL (that contain and display the iframe in this case):

Resulting .htaccess code based on this will be:


To complete the redirect flow to the iframe phpBB, embedded into WP page, for phpBB email notification messages links to point to iframe follow also with these two steps (get ready files for phpBB 3.2 on bottom of this page):

For email notification links that you want to redirect to iframe forum page of WP, assuming we point to three main behaviors we are interested in, which are for example PM notifications, New posts and Topics on forum, we need to change so 3 phpBB files in this way:

open folder  your-phpBB/phpBB/notification/type

on this folder, as working example, we go to open and so modify the following files:

pm.php, post.php, topic.php

on each file, you’ll find very similar code like this (in pm.php there is only one to change, on topic.php and post.php there are 4 or 5. Do not apply this edit to the last one string on post.php and topic.php):

you should change these urls, adding iframe=true& on each line, exactly after the ? char, like this:

Ready files for phpBB 3.2 zip:

How are users identified when you add/transfer existent user
integration of same username/email users

Problem: i have WordPress users and I have phpbb users, they have different usernames but the same email addresses.


user A into phpBB with email C
user B into WP with email C

user A into phpBB come to try to login WP: NOT added can’t login WP side.

If you use the transfer process of WP users into phpBB:

user A Same above.
user B transferred into phpBB, B now can login into both phpBB and WP.
You’ll have two users into phpBB with same email, which is possible as option into phpBB.

You can also merge posts/users into one user in this way:

Change email to the user B in WP.
Login with the phpBB user A into WP, that will be added, as no same email found.
Now delete user B in WP, and retain posts assigning to A.

Result: an unique user, with all his posts on both phpBB and WP.

NOTE: This is just to give an idea on how to resolve common problems about an integration with pre existent users in phpBB that may have same email. But there are several more possibilities: in phpBB ACP there are many options to manage users and posts, and combining these and from the above, you should get the way to resolve any possible scenario.

Based on this topic: How are users identified? (when adding/transfer existent users)


Install phpBB WordPress domain/subdomain integration: how to hints

phpBB installed at
WP installed at

To install wp_w3all on a subdomain/domain i have use the custom config.php option, as we are here in subdomain installation. I’ve see it was not working about connession. It was failing because, the custom wp_w3all phpBB config.php file, was lacking the follow setting, which was REQUIRED to connect on my/this server correctly (as on plesk config setting i had set allow only from localhost connections), so:

(this my setting, check your host/port)

So, on phpBB ACP cookie setting:
i had as default phpBB cookie value:
i’ve modify it to:
I have also set admin of phpBB with same email of WP.
SO I HAVE CLEAN COOKIES on browser, and login successfully.
All working nice.

(For security reasons by the way, should be not good practice to have an administrator named admin: commonly it should be removed and replaced by someone not so clear as one named admin, if no other security measures applied on wp).

The above suppose you have follow also steps about phpBB WordPress integration here:

Configure phpBB
to set cookie available all over domain

To configure phpBB to set cookie to be available all over the domain (and subdomains), you need to setup cookie domain and path into phpBB ACP in this way:

Open phpBB Admin Control Panel, go under

Server configuration -> Cookie settings
Cookie domain value should be set like the domain name is: so if your site domain is as in this example,, the correct value to set is:
in this way cookies become available all over and any subdomain like

Cookie path setting should be set as a single fraction slash: /
Save settings.
If changed cookie setting in phpBB in this way, logout, CLEAN cookies from browser, and re-login.

if on localhost, may leave the value as is. If on subdomain, like, set it as above using only domain name

If you have change these values, Logout, CLEAN cookies from browser, and re-login.

( Older browsers still implementing the deprecated » RFC 2109 may require a leading . (dot) to match all subdomains, so )

NOTE: if cookie setting has been changed to be available over all domain because it was not, then all phpBB users may need to re-login using new board’s cookie settings: in this case, you may would like to force all phpBB users to re-login in case they saved their session cookie with a ‘remember me login’. This can be done by accessing phpBB ACP main page: check for option
Purge all sessions
Purge all sessions. This will log out all users by truncating the session table.
Click the Run now button.
Be sure that the cookie setting is correct before to execute these steps, or you’ll be logged out by your board until you’ll not reset to the correct cookie domain! OR, correct setting will be: (while if you are on a subdomain hosting plan like, than the setting will be, but this is a more rare case)

The following help hint hint here is obsolete as latest patched wp_w3all 1.8.9 version.

from latest patched  1.8.9 plugin version it is just required that the phpBB cookie setting is set correctly to be available over all the domain: then the plugin code will setup correctly at any time the same value for himself in WordPress. The follow is here for reference, but not more useful or needed in effect.

If still in trouble with cookie setting (you can’t login with user via WP login after path to config.php has been setup) follow this step:

just in case, this is the way to fix any problem:

open file wp_w3all.php and +- on top you’ll see these lines:

change the second line, removing the two // in front, so the above become something like (change with your domain name)

if on localhost, setup as ‘localhost’
save/overwrite the wp_w3all.php file, then test the login. If all ok, then the cookie setting for the plugin is ok now. Re-add the two // slashes in front of the edited line on wp_w3all.php to deactivate it (or remove the line), and save/overwrite the file wp_w3all.php.

Hint/memo: if an user login via phpBB and the cookie setting setup in phpBB ACP is to release the cookie to be valid over all the domain (as above explained), then also if the cookie setting of the plugin is wrong, the user will be correctly auto logged in WordPress when will visits WP side as logged phpBB user, because a valid phpBB cookie to check against will be found.

That’s all here!