phpBB WordPress template integration (iframe v2)

See  NEW v3 phpBB WordPress template integration code

v2 version (OBSOLETE)

See  NEW v3 phpBB WordPress template integration code

PAGE HELP and JS code – UPDATED on 21 Dec 2018
(related views/page-forum.phpupdated on 26 Sep 2018)

you need to use this version of page-forum.php for this javascript code:
/tags/1.9.3/addons/page-forum.php

wp_w3all responsive iframe procedure

After you’ve built/created the WP forum template page via
WP_w3all phpBB embedded on WordPress Template
option on WP_w3all admin config page, and the blank page on WordPress Admin -> Pages -> Add New, titled the same of created wp_w3all template page, so forum or board  etc (then you’ll have into your active WordPress template folder a file named page-forum.php or page-board.php etc), to complete the procedure and get the responsive iframe height for the embedded/iframed phpBB into WordPress template page you need:

Open with a text editor your phpBB template file overall_footer.html

and just before the closing </body> tag, add this code (do not select lines numbers column on copied code):

after you pasted this code into phpBB overall_footer.html
edit following lines:

change axew3.com to fit your domain name (example axew3.com)
do NOT add http(s):// OR the point in front nor anything else, just add
yourdomain.com or set it as localhost if on localhost test. If phpBB is at subdomain.domain.com, add domain.com as value
(MANDATORY!) or resizer won’t work
now check the other line to change:

change value
https://www.axew3.com/w3/forum
on this line, to point to the URL of the WordPress created forum page
(do not add final slash and change http or https as needed)
MANDATORY!

Finally, check this line

in the code you added (last line): this should correctly point to the iframeResizer.contentWindow.min.js file that you’ll go to add into phpBB root folder. You need to use the absolute URL (use http or https as needed, and adjust the url to fit your needs)
(MANDATORY!) or resizer won’t work

AFTER EDITED, save and load the modified overall_footer.html into your phpBB style folder, overwriting the default one, and so

load through ftp on the phpBB root folder (or copy/paste), the file
iframeResizer.contentWindow.min.js
that is contained inside folder
wp/wp-content/plugins/wp-w3all-phpbb-integration/addons/resizer

After this, phpBB require to recompile the template, or modifications to template files not affect (to overall_footer.html in this case). Open phpBB ACP, and so under:

Server Configuration -> Load settings -> Recompile stale style components set to YES and save. Load one time a phpBB full forum page. So return to ACP and reset to NO, save. This step is needed one time to load the template modifications on phpBB (and any time you edit a phpBB template file to for modifications take effect), but this option should be ever set to NO into an online/production site to save server resources. It is normally set to yes only for testing/devel purpose or to apply modifications on phpBB templates files.

How to update to latest iframe js code and page-forum.php?

Update the plugin (or download plugin and copy files by /resizer folder)
so files inside folder
/wp-content/plugins/wp-w3all-phpbb-integration/addons/resizer
results updated (or do it manually substituting these files with latest released https://github.com/davidjbradshaw/iframe-resizer)
so substitute/replace the file you added into phpBB root folder with latest iframeResizer.contentWindow.min.js
copy it from
/wp-content/plugins/wp-w3all-phpbb-integration/addons/resizer
folder and replace in phpBB root folder.

Replace the old code added into phpBB overall_footer.html file with the new one above into this page, take care to setup on it needed values as now  required.

Remember to rebuild phpBB template after these steps to let changes take effect.

Now rebuild the page forum in WP w3all admin page, or manually copy the new page-forum.php version contained on folder
/wp-content/plugins/wp-w3all-phpbb-integration/addons
and paste it into your WordPress template folder, renaming it as needed, so for example page-board.php if you setted up board for the forum page name on wp_w3all admin page.

Done.

Note: if you want a custom page-forum, just open the page-forum.php (or whatever you named it) and read inline hints inside. It is so easy to create a custom page forum (for example with two columns etc). If any help more. just post on help forums here at axew3.com or at wordpress.org.



If you want phpBB email notification links to point to iframe, follow this step about htaccess:

phpBB htaccess for phpBB notification email to point WP forum page (1.6.9>)

to activate the rewrite right click/copy links on iframe, to point to iframe, activate the related code removing the two lines:

/* remove this line to activate htaccess trick
and
*/ //remove this line to activate htaccess trick

NOTE: to get the iframe to be responsive for ACP phpBB admin panel, read this post.

Transfer phpBB users into WordPress or WordPress users into phpBB

If you want to use the phpBB WordPress integration plugin just to transfer users between WordPress and phpBB or phpBB to WordPress, follow instructions on this help page:

WordPress phpBB integration without linking users

WordPress phpBB integration without linking users

NOTE: from 1.9.4 > this feature become option on plugin admin page, so may it is needed further read more below only if updating from old plugin versions: update the plugin, then login plugin admin and setup as YES the new plugin option

Activate integration without linking users between WordPress and phpBB

Will not be further more necessary to edit the wp_w3all.php file each time plugin update, to set it up the integration as Not Linked Users.

It is possible to use the plugin without linking users between WordPress and phpBB. You can display Last Topics Widgets and Shortcodes to display phpBB Last Posts or Posts content into WordPress Pages/Posts. It is also possible to use the iframed WP page, to display the phpBB forum into a WordPress page (also cross domain*). Without linking users, you may can integrate also a version of phpBB prior (<) of phpBB 3.1 to display phpBB Last Topics Widgets/Shortcodes or phpBB Posts Shorcodes into WordPress.

The plugin can be used in this state also to transfer/migrate users between phpBB and WordPress or viceversa.

It is necessary to activate the plugin: setup the Path and URL setting following instructions into WP admin -> Settings -> WP_w3all config page. You do not need to follow any other further instruction about cookie setup and/or phpBB ACP settings in this case. So after plugin has been activated, by setting Path to a valid phpBB config.php file and URL setting, you can use Widgets Last Topics Posts and use Shortcodes into WP pages and posts, to display phpBB contents or to use the users transfers options in this state. The URL setting if the plugin is merely used to transfer users, is not needed. Just setup the path to a valid phpBB config.php file.

Hint Note*: without linking users between phpBB and WordPress, it is also possible to use the plugin for cross domains installations (not only domain and subdomain). Just create a valid custom phpBB config.php file, as suggested into Wp admin -> WP_w3all config page, and use it.

WordPress Shortcode: last phpBB topics/posts into WP post

Vers. 1.0

check all others shortcodes listed under the “common how” to section

WordPress phpBB Latest phpBB Topics shortcode how to

To add a WP_w3all shortcode, and display a list of Latest updated phpBB Topics into a WordPress post/page, the WordPress shortcode to use is like this:

change the topics_number value 5 with the number of Last phpBB topics/posts you need to retrieve and display.

To display with post text, use the shortcode in this way:

change the text_words value 30 based on how many words you want to display for listed posts.

This feature use the same avatar’s settings choose in WP_w3all config page. Since 2.5.5> you can suppress/remove avatars on each shortcode using this param:

Note: in case you want to add custom style the output of Last Topics/post shortcode, the file used by the Last Topics/post shortcode you need to look for, may to add custom modifications is:

wp-content/plugins/wp-w3all-phpbb-integration/views/phpbb_last_topics_output_shortcode.php

that is not the same used to output phpBB Last Topics on widgets, which is instead the file phpbb_last_topics.php  (as you’ll see on same folder).

Note: that same activated options (like the “Exclude phpBB forums from listing on Last Topics Posts“) in plugin admin, affect this shortcode.

From 1.9.7 > (vers. 2)

From Wp_w3all 1.9.7 > it is possible to use 3 attributes more on this shortcode which are:

NOTE: if w3_ul_class attribute used, then all these three attributes are processed to be used on the shortcode output. If not present this attribute, the old shortcode way apply.

w3_ul_class=”myClassXUL” will assign myClassXUL class to the UL element wrapper.


w3_li_class=”myClassXLI” will assign myClassXLI class to LI elements inside the UL.

w3_inline_style=”list-style=none;” will output the inline style style=”
list-style=none;”

if going to use w3_inline_style note that special characters inside this attribute, may require to be escaped.

WP_w3all phpBB integration and phpBB profile fields

Original post, shortcoded here is at this URL:
https://www.axew3.com/w3/forums/viewtopic.php?f=13&t=573&p=2300#p2300

OBSOLETE
[strike]About WP_w3all and Profile Fields integration
[/strike]

The WP_w3all integration between WordPress and phpBB, to be fully compatible without any change into his default queries (code), require that profile fields in phpBB are the same as these are into a default phpBB install. If not:

On a default WordPress install (no Buddypress) from WP_w3all 1.7.5, if phpBB profile fields not match the default install fields list, no error is thrown when user update his profile in WordPress, but no updates are done in phpBB except for email and password. So in this case there is no profile fields integration when update is done in WP side for others phpBB profile fields, except for email and password. On a default WordPress install by the way, unique other profile field that can really interest is the user's URL. It will not be updated in phpBB (when update is done via WP) if default number of phpBB profile fields on db mismatch or fields aren't named as a default phpBB install.
This may will be fixed on next version(s).

On WP + Buddypress, if on WP_w3all you go to activate Synchronize Buddypress/phpBB user's profile fields option, then you need to have the phpBB default Profile Fields configuration on phpBB. This is explained in this following procedure:

suppose that on phpBB, one of the default profile fields, let say the Website profile field for example, has been removed in
phpBB ACP -> Users and Groups Tab -> Custom profile fields
On updating user profile in WP, php return an error that +- will look like this: WordPress database error: [Unknown column 'pf_phpbb_website' in 'field list'] UPDATE phpbb_profile_fields_data SET pf_phpbb_website = 'http://php.net/' WHERE user_id = '2' Or suppose you have add one or more custom phpBB profile fields. Also in this case the WP_w3all plugin will return an error similar to the above.
The plugin integration of Buddypress fields with phpBB, as is at moment of this post, require that profile fields in phpBB are the same as these are into a default phpBB install.

If you have add custom (or removed) profile fields in phpBB than the default phpBB install, solutions are only two:

1) Eliminate custom profile fields in phpBB ACP, re-adding needed default fields if you deleted one or some of these, and/or eliminating what added as custom profile fields, if you have not delete any of default profile fields but only added. Follow with this procedure to resolve.

2) Directly edit the plugin queries code to match custom phpBB profile columns on DB. If necessary some help, post a topic on appropriate forum, i will be glad to help understand whenever necessary, if someone want resolve some issue in short. On next versions, the code about profile fields queries will be unified, and all will result more easy and comfortable to customize for any more advanced use of it. At moment of this post, there are some points (queries that are all the same), that need to be edited to match a non default phpBB install, profile fields configuration.

Procedure to reset to a default phpBB profile fields configuration, as it is when phpBB is installed.

phpBB 3.2 > profile fields

On phpBB 3.2 default profile fields are as follow:

phpbb_location, phpbb_website, phpbb_interests, phpbb_occupation, phpbb_aol, phpbb_icq, phpbb_yahoo, phpbb_facebook, phpbb_twitter, phpbb_skype, phpbb_youtube, phpbb_googleplus

On phpBB 3.1 < there is one more by default:
phpbb_wlm

which are referring to: location, website, interests, occupation, aol, icq ... etc profile fields, as you can imagine.

If there are fields you have add that aren't in the above list, and you have not delete any of these default phpBB profile fields, just remove custom fields you've add, and all is done.
If you need to recreate some of these, after you have delete added customs profiles fields, go to recreate these missed default fields in this way:

Open phpBB ACP -> Users and Groups Tab -> Custom profile fields
assuming for example we need to recreate the Website profile field, which is an URL (Link) field type, we'll go to recreate it with same default name for the field in the database, as was on default.
Before to click on Create new field button, choose from the options menu, right on the left of the button, the option URL (Link), than click Create new field button.
The page Add profile field display now.
There are various options to setup, but what is important and that need to be setup precisely with correct phpBB default value is the:

Field identification: The field identification is a name to identify the profile field within the database and the templates.
In this case, as Field identification value we'll put phpbb_website . Setup all the rest as you prefer.
Than click on button Profile type specific options
Than click on button Language specific options
Than click save.

Repeat these steps for each field you need to recreate, choosing the field type you need to recreate, following this list hint:

Field identification -> phpbb_location -> Single text field
Field identification -> phpbb_website -> URL (Link)
Field identification -> phpbb_interests -> Textarea
Field identification -> phpbb_occupation -> Textarea
Field identification -> phpbb_aol -> Single text field
Field identification -> phpbb_icq -> Single text field
Field identification -> phpbb_yahoo -> Single text field
Field identification -> phpbb_facebook -> Single text field
Field identification -> phpbb_twitter -> Single text field
Field identification -> phpbb_skype -> Single text field
Field identification -> phpbb_youtube -> Single text field
Field identification -> phpbb_googleplus -> Google+


phpBB 3.1< contain by default one field more (about Windows live messenger) that is the follow:

Field identification -> phpbb_wlm -> Single text field

WordPress Shortcode: phpBB posts into WP post

WP_w3all 1.7.4 or >

check all others shortcodes listed under the “common how” to section

phpBB posts – WP post shortcode how to

To add a WP_w3all shortcode, and display a phpBB post into a WordPress post, choose a phpBB Post ID (note: post ID NOT Topic ID) to display, and add it into WordPress post, like this:

Change the value 1202 with the post ID you need to display.
( POST ID NOT TOPIC ID )

If you want display the post as plain text (so the bbcode will be removed by the output) use:

If you want to display with specified number of words, use the parameter/attribute wordsnum (both plaintext and wordsnum can be used together) . Note that may you have to adjust wordsnum parameter to a number of words to be retrieved that will output exactly what you want, because the count of words will include html tags

The simple bbcode parser function, display all default bbcode tags, excluded flash and email, check the list on this phpBB help page, phpBB bbcode how to
which are:

[attachment] [b] [u] [i]  [list] (all lists type) [size] [color] [url] [image] [code]

added: [media] bbcode parsing (video etc embed)
useful if in phpBB installed the media embed  mod.

Note: on this phpBB installation, it is not installed the phpBB Media Embed mod to display media/video into phpBB posts, by the way, adding the [media] bbcode into a phpBB post like this:

in this case the [media] bbcode into the real phpBB post will not be parsed (because the Media Embed mod has not been installed into this phpBB) but will be parsed into the WP post, because recognized by the plugin code, and parsed by WordPress.

It can be considered as 1.0 version, that work quite fine until bbcode tags structure is respected.

Follow an output example for a phpBB postID 2249
which you can see here in phpBB:

https://www.axew3.com/w3/forums/viewtopic.php?f=13&t=566&p=2249#p2249

the shortcode used into this WP post to display the phpBB postID 2249, with bbcode formatted, will be this:

Shortcode output for post id 2249 is right here:

This is huge red text
So i want an image in attach inline
southpcheers.jpg
southpcheers.jpg (21.54 kb)

then a file inline in attach
phpseclib1.0.19.zip (273.42 kb)
then i want this text bold,
and after i like to display a piece of code:

<?php function test() { $foo = "local variable"; echo '$foo in global scope: ' . $GLOBALS["foo"] . "\n"; echo '$foo in current scope: ' . $foo . "\n"; } $foo = "Example content"; test(); ?>
then i want display a big text without colorize it:
WoW! i like it ... but could be better
and i have some lists to display:

  • The first possible answer
  • The second possible answer
  • The third possible answer
in different format
  1. The first possible answer
  2. The second possible answer
  3. The third possible answer
but i like also to see the underline text
or quoted text:
this text is quite quoted
so a nice image:

then more bad code: <test />$find = array( '~\[img\].*?\[/img\]~si', // if there links/text for the image elsewhere, remove. Done above '~(^(\r\n|\r|\n))|^\s*$~m', ......... ); and an url with text
Visit phpBB!
and an url
https://www.wordpress.org/
and more code for bbcode to be parsed: // partial bbcode regex $find = array( '~\[b\](.*?)\[/b\]~usi', '~\[i\](.*?)\[/i\]~usi', '~\[u\](.*?)\[/u\]~usi', '~\[quote\](.*?)\[/quote\]~usi', '~\[size=(.*?)\](.*?)\[/size\]~usi', ); and an image link also:



NOTE: on this phpBB example it is not installed the phpBB Media Embed mod, to display video into phpBB posts, but if i add this bbcode into this phpBB post like this:

it will not be parsed into this phpBB post, because the mod has not been installed in phpBB, but will be parsed into the WP post because recognized and parsed by the WP_w3all plugin code.

you cannot add, expecting it will be parsed: flash or email bbcode tag.
see the result of this post parsed into a WordPress post via Shortcode here: https://www.axew3.com/w3/2017/07/wordpress-shortcode-phpbb-posts-into-wp-post/

you need a more improved version of the function that do this? email me here: me@you.us
As you see was not so important to add email parsing .... (what?)

Cheers to all cool people!

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();
into
$phpbb_c = new \phpbb\db\driver\mysqli();

to switch and use mysqli.

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

Configure WP_w3all on WordPress MS MU

WP_w3all plugin from 2.0.2 – 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 the 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. Users that register in phpBB (if you allow this in phpBB) 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.

OPEN wp-config.php file:

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

immediately after ADD:

NOTE since 2.7.9>

If you want the phpBB users additions in WordPress allowing all default WP characters for the WordPress usernames, add the follow:

adding the above, allowed characters for WordPress usernames that are added in WordPress from phpBB, becomes:

so alphanumeric characters (letters and numbers) spaces, underscores, hyphens, periods, and @

The default WP MUMS normally and by default only allow the range

so only alphanumeric characters

BEWARE that it is NOT possible to link different phpBB installations on same installation network, the integration in this state lead to unpredictable results! 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 the 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 may also deleted this user in phpBB) while the user has been deleted in WP, but his email/username still stored into WP database signups table.

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

OLD OBSOLETE

follow the new iframe v3 template procedure

OLD OBSOLETE

Since 1.7.2, follow iframe  instructions installation:

Embed phpBB into WordPress template:iframe responsive how to