Re: A new port of phpBB mChat into WordPress is coming
Posted: Sun Jan 20, 2019 4:27 pm
Here we go ...
You can be ready to display the result before then me, because here mChat isn't installed: i will setup the working example in a second time, into another separated test domain.
I think to not have forget nothing here, and that you'll find really easy to execute required steps. Please let me know any problem. You also will experience the nice sensation of users chatting between phpBB and WordPress.
Note that the option on phpBB to: display or not to specified user group the chat, affect if integration run as linked users! So if an user in phpBB can't see the chat, then he can't see nor in wp.
From 1.9.5 all phpBB user's options will be available in WordPress, to check against and activate related feature/option, or not, in WordPress side, if/when needed. This is done easily with a separated query at moment, that will be unified into the main plugin user session query as soon (on next coming release). Leaving all this apart now, let go with the
WordPress phpBB mChat integration procedure
before to follow and apply procedure, it is needed to install this (let name it in this way) RC 1.9.5 in attach:
changed files are:
/wp-w3all-phpbb-integration/wp_w3all.php
/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php
/wp-w3all-phpbb-integration/class.wp.w3all.widgets-phpbb.php
/wp-w3all-phpbb-integration/views/config.php
added:
/wp-w3all-phpbb-integration/views/wp_w3all_phpbb_mchat.php
to display the mChat into a widget. The shortcode is coming soon.
May just replace all files of the plugin 1.9.4 with these new 1.9.5 RC.
Activate the new mChat option on plugin admin page, or activate it after all procedure done
phpBB mChat integration
Activate the new wordpress chat widget when all procedure done
The procedure, require to edit two mChat files at moment and to add a function into the overall_footer.html file: i will ask to kasimi author, whenever he will feel fine on do this, to little change the code of the mChat mod, making it output ABSOLUTE URLs on chat UI, in place of actual relative URLs (for avatars images for example).
So (assuming using prosilver, if not open the one of your theme):
Open with a text editor the file
/your_phpbb/ext/dmzx/mchat/styles/prosilver/template/mchat_body.html
and immediately after this line:
add this:
Change forum with the page name you use (and that you built for the WP template forum page if you are using iframe mode, if not using iframe mode, the fact that you change or not this not affect, but the code as is, in any case need to be added).
Save and replace (may remember to recompile templates and leave the option active almost until not finished with procedure, or better, do this when all applied).
This is the ready mchat.php file, for mChat version 2.1.1 modified to render absolute URLS: download and open with a text editor:
Search for this line (you'll find 2 times):
change the URL to MATCH your phpBB real url, add final slash, and nothing else after. Note that there are two lines of this to change.
Save and Replace the default one with this one you've edit on folder:
/your_phpbb/ext/dmzx/mchat/core/mchat.php
add this code:
Activate the new mChat widget in WordPress!
This has been tested working ok on prosilver theme, hope that will be ok also for others theme. It is easy to adapt.
I will re-think the code of this on fly hack/integration to make it more easy, may the mChat author will help on make it more comfortable in the way i explained above (absolute urls), and so, even if it easy to do as is, will be not necessary to edit the mchat.php or the mchat_body.html files, and integrate the mChat in WordPress will be a joke for all.
You can be ready to display the result before then me, because here mChat isn't installed: i will setup the working example in a second time, into another separated test domain.
I think to not have forget nothing here, and that you'll find really easy to execute required steps. Please let me know any problem. You also will experience the nice sensation of users chatting between phpBB and WordPress.
Note that the option on phpBB to: display or not to specified user group the chat, affect if integration run as linked users! So if an user in phpBB can't see the chat, then he can't see nor in wp.
From 1.9.5 all phpBB user's options will be available in WordPress, to check against and activate related feature/option, or not, in WordPress side, if/when needed. This is done easily with a separated query at moment, that will be unified into the main plugin user session query as soon (on next coming release). Leaving all this apart now, let go with the
WordPress phpBB mChat integration procedure
before to follow and apply procedure, it is needed to install this (let name it in this way) RC 1.9.5 in attach:
changed files are:
/wp-w3all-phpbb-integration/wp_w3all.php
/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php
/wp-w3all-phpbb-integration/class.wp.w3all.widgets-phpbb.php
/wp-w3all-phpbb-integration/views/config.php
added:
/wp-w3all-phpbb-integration/views/wp_w3all_phpbb_mchat.php
to display the mChat into a widget. The shortcode is coming soon.
May just replace all files of the plugin 1.9.4 with these new 1.9.5 RC.
Activate the new mChat option on plugin admin page, or activate it after all procedure done
phpBB mChat integration
Activate the new wordpress chat widget when all procedure done
The procedure, require to edit two mChat files at moment and to add a function into the overall_footer.html file: i will ask to kasimi author, whenever he will feel fine on do this, to little change the code of the mChat mod, making it output ABSOLUTE URLs on chat UI, in place of actual relative URLs (for avatars images for example).
So (assuming using prosilver, if not open the one of your theme):
Open with a text editor the file
/your_phpbb/ext/dmzx/mchat/styles/prosilver/template/mchat_body.html
and immediately after this line:
Code: Select all
{% if MCHAT_PAGE in ['custom', 'archive'] %}
Code: Select all
<script>
var boardU = "{BOARD_URL}";
if( /\/forum\//ig.exec(document.referrer) == null && (document.referrer.indexOf(boardU) > -1) == false )
{
var w3_chat_phpBBpage = true;
}
</script>
Save and replace (may remember to recompile templates and leave the option active almost until not finished with procedure, or better, do this when all applied).
This is the ready mchat.php file, for mChat version 2.1.1 modified to render absolute URLS: download and open with a text editor:
Search for this line (you'll find 2 times):
Code: Select all
$w3allU = 'https://localhost/root_integrations/phpbb323/'; // NOTE: add FINAL slash here
Save and Replace the default one with this one you've edit on folder:
/your_phpbb/ext/dmzx/mchat/core/mchat.php
Now the final step: on the overall_footer.html of your theme, where this line (or before the other iframe resizer added code):The file has been changed into another point also and if you like to know how all the joke has been done, check for these lines:there are 3 in total.Code: Select all
// START w3all mod
add this code:
Code: Select all
<script>
// a simple mChat style/display example setup for WP because ...
// may phpBB header,footer, and some common behaviors need to be modified in this way: but the joke could be accomplished in several other ways
// the file ext/dmzx/mchat/styles/prosilver/template/mchat_body.html (or any other theme you'll use)
// need to be edited adding the needed js code for this to work ... could be done in some other way
// but this will work simple as is ...
if( typeof w3_chat_phpBBpage != 'undefined' ){
$( document ).ready(function() {
$( "#page-header,#page-footer" ).css( { "height" : "0px","overflow": "hidden" } ); // can't be none, or events will not affect
$( "body" ).css( "padding", "0px" );
$( "div#page-body.page-body h2" ).css( "display", "none" );
$( "div.mchat-text blockquote div cite a" ).click(function(e) {
if( /\?jumpto=/ig.exec(this.href) == null ){
e.preventDefault();
window.open(this.href,'_blank');
return;
}
});
});
$( "div.list-inner span.mchat-title a" ).click(function(e) {
e.preventDefault();
window.open(this.href,'_blank');
return;
});
$( "a[href='#']" ).click(function(e) {
e.preventDefault();
return;
});
$( ".username,.username-coloured,#mchat-legend a" ).click(function(e) {
var href = $(this).attr("href");
if( typeof href != 'undefined' ){
e.preventDefault();
window.open(href,'_blank');
return;
}
});
}
</script>
Activate the new mChat widget in WordPress!
This has been tested working ok on prosilver theme, hope that will be ok also for others theme. It is easy to adapt.
I will re-think the code of this on fly hack/integration to make it more easy, may the mChat author will help on make it more comfortable in the way i explained above (absolute urls), and so, even if it easy to do as is, will be not necessary to edit the mchat.php or the mchat_body.html files, and integrate the mChat in WordPress will be a joke for all.