phpBB WordPress template integration (iframe v5)

v5 version (for cool people)

PAGE HELP – JS code – updated on 10 Oct 2020
(related addons/page-forum.phpupdated on 22 Feb 2020)

wp-w3all-phpbb-integration/trunk/addons/page-forum.php

wp_w3all plugin 2.1.1 or >

phpBB SEO mods compatible – (READ ALL this page)

wp_w3all responsive iframe procedure

WordPress phpBB iframe template integration

MEMO: to update to latest code, it is required to rebuild page-forum.php (or whatever you named it) via plugin admin, OR manually substitute it into your active WP template folder, with the new one that you find/copy into /wp-content/plugins/wp-w3all-phpbb-integration/addons. You’ll may need to update also the iframeResizer.contentWindow.min.js and iframeResizer.contentWindow.map files added into phpBB root, with news updated files you’ll find into /wp-content/plugins/wp-w3all-phpbb-integration/addons/resizer folder (this step is not ever required, but only when iframe resizer library updates, which is notified on plugin changelog when plugin released). Done this, substitute the phpBB overall_header.html and overall_footer.html code (re-adding needed values) with the new v5 code here below. Do not forget to rebuild phpBB template to make phpBB template modifications take effect.

NOTE for domains like: mydomain.co.uk – note that to fix the resizer to work fine on this kind of domains you have to open page-forum(or whatever you named it).php into your active WP template folder and search for these two lines of code, adjusting as they need to be, to match the same domain you setup into overall_footer.html code

WP_w3all template integration steps

After you built/create the WP forum template page via option
WP_w3all phpBB embedded on WordPress Template
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:

overall_footer.html code

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 rows numbers on copied code):

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

change document.domain value to fit your domain name (example axew3.com)
do NOT add http(s):// OR the point in front or 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, if wp is at domain.com
(MANDATORY!) or resizer won’t work
now check the other line to change:

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

Change the w3 value of the line

to fit the value you may changed in plugin admin where option: Fancy URL query string for the WordPress page forum that embed phpBB

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 via ftp into the phpBB root folder (or copy/paste), both files
iframeResizer.contentWindow.min.js AND iframeResizer.contentWindow.map
that you find inside the 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. Leave as is at moment, especially if you follow adding also the code on overall_header.html (more below) to redirect any phpBB direct URL to the iframed WP page: then after tested that all work fine, return to ACP, and reset to NO and save. This step is needed 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.

overall_header.html code

If you want phpBB email notification links or any phpBB direct url to be redirected to the wp iframed forum page follow this step:

Open with a text editor your phpBB template file overall_header.html and immediately after the closing </title> tag add the following code:

On added code, change URL on the line where:

to fit/point to the WordPress iframed forum page: DO NOT ADD final slash and setup as http or https as needed.

Change the w3 value of the line:

to fit the value you may changed in plugin admin where option: Fancy URL query string for the WordPress page forum that embed phpBB

Reset to No the Recompile phpBB template option. Before to follow READ NEXT NOTE and memorize!

NOTE: if you need to disable/remove the overall_header.html javascript code, that do not allow (until javascript enabled on browser) to access front end real phpBB urls, forcing the redirect to the WP forum page. You can  disable javascript on browser, if you do not want to remove/disable the added js snippet into the phpBB overall_header.html file. It is also !important to remember this if in trouble with login, and recompile Stale Template option in phpBB is set to Off at this time.

For testing or for any other reason, you could also comment out the line where:

change into this:

so phpBB direct URL’s will not being redirected to the WP page forum URL. Remember that to apply template modifications, phpBB require to recompile templates files.

NOTE: if you added the code above into phpBB overall_header.html then you’ll never activate (it is not active by default) this part of the code you added into the overall_footer.html:

Refer to v2 or v1 code for htaccess old solution editing phpBB notifications files.

2 thoughts on “phpBB WordPress template integration (iframe v5)”

  1. I understand that your primary language is not English, so if you can help, I am going to ask for some clarification. This is my first time trying to get phpbb in an iframe, up till now we have used w3all as a middleman between wp and phpbb.

    First clarification.
    “it is required to rebuild page-forum.php (or whatever you named it) via plugin admin, OR manually substitute it into your active WP template folder, with the new one that you find/copy into /wp-content/plugins/wp-w3all-phpbb-integration/addons. ”

    does this mean – copy page-forum.php from /wp-content/plugins/wp-w3all-phpbb-integration/addons to the top level of my active child theme directory (i.e. /wp-content/themes/twentytwenty-child/)

    Second clarification.
    If I did not change the name of page-forum.php then in the “Create or rebuild WordPress forum page template” field on the “WP_w3all phpBB embedded on WordPress Template” section of the w3all Options page I would enter ‘forum’ (without quotes) and create and save a blank page with the title ‘forum’ then click the “Create/Rebuild WP_w3all phpBB Page Template” button.

    Third clarification.

    “OVERALL_HEADER.HTML CODE
    If you want phpBB email notification links or any phpBB direct url to be redirected to the wp iframed forum page follow this step:”

    Can you add more information or examples?

    Fourth clarification.
    If I added the code to the overall_header.html, but I am not ready to implement the iframes yet I can comment out the line “document.location.replace(href0);”

    document.location.replace(href0);
    change into this:
    //document.location.replace(href0);

    you go on to say
    Fifth clarification.
    “NOTE: if you added the code above into phpBB overall_header.html then you’ll never activate (it is not active by default) this part of the code you added into the overall_footer.html:

    $( “a” ).contextmenu(function() {
    var ohref = $(this).attr(“href”);
    var href = this.href; // treath like an external because only open New tab or New window
    d = w3allNormalize_phpBBUrl(href);
    hrefEnc = window.btoa(unescape(encodeURIComponent(d)));
    href1 = wordpress_url_page_forum + ‘/?w3=’ + hrefEnc;

    $(this).attr(“href”, href1); // send out encoded
    $(this).mouseleave(function() { // reset (replaced ‘mouseup’)
    $(this).attr(“href”, ohref);
    });
    });

    $( “a” ).contextmenu(function() {
    var ohref = $(this).attr(“href”);
    var href = this.href; // treath like an external because only open New tab or New window
    d = w3allNormalize_phpBBUrl(href);
    hrefEnc = window.btoa(unescape(encodeURIComponent(d)));
    href1 = wordpress_url_page_forum + ‘/?w3=’ + hrefEnc;

    $(this).attr(“href”, href1); // send out encoded
    $(this).mouseleave(function() { // reset (replaced ‘mouseup’)
    $(this).attr(“href”, ohref);
    });
    });

    I am not clear what you are trying to say in the fifth clarification. In the overall_footer.html the above code is commented out. Are you saying that if I do the setup, but I am not ready to implement the iframes, along with commenting the line in the overall_header.html (Fourth clarification.) I should uncomment the above code (Fifth clarification) in the overall_footer.html.

    Thank you for a great tool, sorry for the long question.

    1. [EDITED]

      Hello! Thank you for points you ask for, i just hope my Eng in the while improved a little … let see
      With 2.4.0 > all may will be rewritten by someone else and not be me!

      Answers (that i hope again will not go to cause more confusion than before!)

      First:
      yes, into child can be, by the way, the plugin code, add it into the main template folder instead, not on the child folder (so you’re right, may when the theme update happen, then your page-forum will be lost (and you’ll have to re-create it). It will maybe patched on next coming v6 code iframe version, with news 2.4.0> plugin’s versions.
      Of course you can copy/move the file into child theme folder manually. It will be used by WP automatically then.

      Second:
      the name you put into, if it is ‘forum’, will create page-forum.php into the active template folder. If you name it ‘board’, it will create page-board.php and so on.
      Based on what you put as value to create the page, whenever the page-(whatEverYouNamedIt).php is not automatically created, you’ll go to copy the default page-forum.php you find into /addons/ folder, naming it in accord with the value you choose: if board, then copy the file and rename it into page-board.php.
      A blank WordPress page named the same (so forum, or board etc) need to be created.

      Third:
      it mean that when you’ll go to apply the overall_header.html javascript code, (until js enabled on browser) any real phpBB request that point to real phpBB URLs, will be redirected to the WordPress forum page, and will display into iframed phpBB on the WP forum page.

      Forth:
      Yes, and leave Recompile stale template option in ACP set to yes, so while you’re adjusting things, direct URL to phpBB are not redirected (as said above). Remember that if in trouble once you activated the overall_header.html, and Recompile template is set to no, you can always disable js on browser, access ACP, set to yes the option, change the code.

      Fifth:
      the code is commented out, and you’ll leave as is if you apply the overall_header.html code.
      This code, was about old versions of the iframe concept. If you go to activate it, when you ‘right click’ over a link and then you choose open link in new tab, it will point the link to the WP page where phpBB iframed display, so that when an user open the url on new tab, it append the url that point the WP forum page, and not the real phpBB URL.
      That is totally not useful when overall_header.html js code addition has been applied, since any real phpBB URL is redirected by the same overall_header.html js code.
      It can also be removed in effect, and will be maybe on v6 version (maybe can stay in place because iseful for someone)

      The plugin move to the next step, versions from 2.4.0 are by email, all rebuilt, and this what it will be soon (this is a real phpBB url, and as you’ll see, you’ll be redirected to iframed phpBB into WP, instead):
      https://www.axew3.com/w3/forums/viewtopic.php?f=2&t=1562

      [EDITED]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.