WordPress phpBB mChat integration procedure
Posted: Thu Jan 24, 2019 8:57 am
OBSOLETE
1.9.5 has been released and the procedure is available here
This post contain the integration plugin wp_w3all 1.9.5 RC2
and the procedure to fully integrate mChat into WordPress, as widget, as shortcode element iframe on page or as button that toggle the chat:
check online example phpBB mChat into WordPress
At date of this post, the code is suitable for phpBB 3.2.. and latest mChat 2.1.2 (but following procedure, there is no reason to think it will not work fine on any version of phpBB and mChat).
This work both on integration running as Linked users or Not.
Note that all mChat options on phpBB, so for example the option to display or not to a 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.
Also note that you need to apply Can view mChat settings on ACP groups permissions. After you choose/select options for the group, click on the APPLY ALL button. Note that you need to do this step even if the option appear as selected or not selected. Choose options that you want to apply and click on APPLY ALL button.
w3all WordPress phpBB mChat integration procedure
before to follow and apply procedure, it is needed to install this 1.9.5 RC3 in attach:
wp-w3all-phpbb-integration_1.9.5_RC1.zip
wp-w3all-phpbb-integration_1.9.5_RC2.zip
(just replace plugin's files with files of this RC release archive: NOTE -> until 1.9.5 or > not released)
Activate the new mChat option on plugin admin page, or activate it after procedure applied:
phpBB mChat integration
on the overall_footer.html of your theme, where this line (or before the other iframe resizer added code):
[code]<!-- INCLUDEJS ajax.js -->[/code]
immediately after ADD this code:
[code]<script>
// a simple mChat style/display example setup for WP
if( /#w3allmchatif/ig.exec(document.URL) != null || /#w3allmchatif/ig.exec(document.location.href) != null ){
$( document ).ready(function() {
$( "#page-header,#page-footer" ).css( { "height" : "0px", "max-height" : "0px", "overflow": "hidden" } ); // can't be none, or events will not affect
$( "body" ).css( "padding", "0px" );
$( ".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;
});
$( "body" ).on("click", ".username,.username-coloured,#mchat-legend a,cite a", function(e) {
var href = $(this).attr("href");
if( typeof href != 'undefined' && /\?jumpto=/ig.exec(this.href) == null ){
e.preventDefault();
window.open(href,'_blank');
return;
}
});
});
}
</script>[/code]
Until this part not added by default into overall_footer.html "official" code, would be necessary to prevent that the resizer scroll on chat, so to avoid this, on the overall_footer.html js code you added, this line:
[code] if ('parentIFrame' in window) window.parentIFrame.scrollTo(0,50); // change 50 to another value may 0 or 100 or 500. Top distance gap in px when page scroll top[/code]
should be changed into:
[code]if( typeof w3_chat_phpBBpage == 'undefined' ){ // activate fix for mchat to not scroll
if ('parentIFrame' in window) window.parentIFrame.scrollTo(0,50); // change 50 to another value may 0 or 100 or 500. Top distance gap in px when page scroll top
}[/code]
This will be added on the default overall_footer.html js code when new plugin version released.
(Note that at date of this post, the overall_footer.html js code has been changed several times to fix little issues now resolved.
#########################
If not running iframe mode, then you do not added the overall_footer.html code of the iframe resizer already, then you'll need to add this into your phpBB overall_footer.html template file, just before the closing </body> tag:
[code]<script type="text/javascript" src="https://www.axew3.com/phpBB/iframeResiz ... dow.min.js" defer></script>[/code]
change the URL to fit /point to the file iframeResizer.contentWindow.min.js you go to add into your phpBB root folder. Copy the file iframeResizer.contentWindow.min.js that is contained inside wp_w3all plugin folder
wp/wp-content/plugins/wp-w3all-phpbb-integration/addons/resizer/
and paste it into your phpBB root folder.
#########################
Remember to recompile phpBB template.
Widget and Shortcode
Activate the new mChat widget in WordPress if you want a widget.
To use/activate the shortcode, that will display as button (like on online example) or as element on page where it is applied, you'll use the shortcode in this way:
to display as element on page/post:
[code] [w3allphpbbmchat] [/code]
to display as toggle button:
[code][w3allphpbbmchat mchat_w3_toggle="1"][/code]
You can't use a widget and/or shortcode instance on same page, nor duplicated of the same on same page:
it can be only: one shortcode x page or one widget x page.
OBSOLETE
1.9.5 has been released and the procedure is available here
1.9.5 has been released and the procedure is available here
and the procedure to fully integrate mChat into WordPress, as widget, as shortcode element iframe on page or as button that toggle the chat:
check online example phpBB mChat into WordPress
At date of this post, the code is suitable for phpBB 3.2.. and latest mChat 2.1.2 (but following procedure, there is no reason to think it will not work fine on any version of phpBB and mChat).
This work both on integration running as Linked users or Not.
Note that all mChat options on phpBB, so for example the option to display or not to a 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.
Also note that you need to apply Can view mChat settings on ACP groups permissions. After you choose/select options for the group, click on the APPLY ALL button. Note that you need to do this step even if the option appear as selected or not selected. Choose options that you want to apply and click on APPLY ALL button.
w3all WordPress phpBB mChat integration procedure
before to follow and apply procedure, it is needed to install this 1.9.5 RC3 in attach:
wp-w3all-phpbb-integration_1.9.5_RC1.zip
wp-w3all-phpbb-integration_1.9.5_RC2.zip
(just replace plugin's files with files of this RC release archive: NOTE -> until 1.9.5 or > not released)
Activate the new mChat option on plugin admin page, or activate it after procedure applied:
phpBB mChat integration
on the overall_footer.html of your theme, where this line (or before the other iframe resizer added code):
[code]<!-- INCLUDEJS ajax.js -->[/code]
immediately after ADD this code:
[code]<script>
// a simple mChat style/display example setup for WP
if( /#w3allmchatif/ig.exec(document.URL) != null || /#w3allmchatif/ig.exec(document.location.href) != null ){
$( document ).ready(function() {
$( "#page-header,#page-footer" ).css( { "height" : "0px", "max-height" : "0px", "overflow": "hidden" } ); // can't be none, or events will not affect
$( "body" ).css( "padding", "0px" );
$( ".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;
});
$( "body" ).on("click", ".username,.username-coloured,#mchat-legend a,cite a", function(e) {
var href = $(this).attr("href");
if( typeof href != 'undefined' && /\?jumpto=/ig.exec(this.href) == null ){
e.preventDefault();
window.open(href,'_blank');
return;
}
});
});
}
</script>[/code]
Until this part not added by default into overall_footer.html "official" code, would be necessary to prevent that the resizer scroll on chat, so to avoid this, on the overall_footer.html js code you added, this line:
[code] if ('parentIFrame' in window) window.parentIFrame.scrollTo(0,50); // change 50 to another value may 0 or 100 or 500. Top distance gap in px when page scroll top[/code]
should be changed into:
[code]if( typeof w3_chat_phpBBpage == 'undefined' ){ // activate fix for mchat to not scroll
if ('parentIFrame' in window) window.parentIFrame.scrollTo(0,50); // change 50 to another value may 0 or 100 or 500. Top distance gap in px when page scroll top
}[/code]
This will be added on the default overall_footer.html js code when new plugin version released.
(Note that at date of this post, the overall_footer.html js code has been changed several times to fix little issues now resolved.
#########################
If not running iframe mode, then you do not added the overall_footer.html code of the iframe resizer already, then you'll need to add this into your phpBB overall_footer.html template file, just before the closing </body> tag:
[code]<script type="text/javascript" src="https://www.axew3.com/phpBB/iframeResiz ... dow.min.js" defer></script>[/code]
change the URL to fit /point to the file iframeResizer.contentWindow.min.js you go to add into your phpBB root folder. Copy the file iframeResizer.contentWindow.min.js that is contained inside wp_w3all plugin folder
wp/wp-content/plugins/wp-w3all-phpbb-integration/addons/resizer/
and paste it into your phpBB root folder.
#########################
Remember to recompile phpBB template.
Widget and Shortcode
Activate the new mChat widget in WordPress if you want a widget.
To use/activate the shortcode, that will display as button (like on online example) or as element on page where it is applied, you'll use the shortcode in this way:
to display as element on page/post:
[code] [w3allphpbbmchat] [/code]
to display as toggle button:
[code][w3allphpbbmchat mchat_w3_toggle="1"][/code]
You can't use a widget and/or shortcode instance on same page, nor duplicated of the same on same page:
it can be only: one shortcode x page or one widget x page.
OBSOLETE
1.9.5 has been released and the procedure is available here