a question many times thrown in the air, was:
what about if an user have two tabs opened on browser one of wp home and other with page forum, AND the user logout on tab where WP home, AND so open the other tab and start to navigate the iframe? Will result as logged out into phpBB, but the WP page until not reloaded will display that the user is apparently logged in, on WP admin bar.
The work around added is very simple, but remember that since these are javascript tricks, they point to work to default WP themes ID and CLASSES html elements.
I will try to post an help to understand this if somebody interested: any phpBB event can be passed in this way to wp with ajax. This can be applied with the code about ajax PM count, not in the default overall_footer.html js code (because into default js code to be added into phpBB overall_footer.html the
window.onload = function() not exist! ...)
The simple workaround:
On phpBB overall_footer.html js added code,
window.onload = function() , has become this:
Code: Select all
window.onload = function() {
var pmn = "{PRIVATE_MESSAGE_COUNT}";
var w3all_phpbb_u_logged = "{S_USER_LOGGED_IN}";
// to send to wp at once here, like this: #w3all_phpbbpmcount=val#w3all_phpbbnotifycount=val#etc etc etc
var w3appendevents = '#w3all_phpbbpmcount=' + pmn + '#w3all_phpbb_u_logged=' + w3all_phpbb_u_logged;
parent.w3all_ajaxup_from_phpbb(w3appendevents);
}
while on page forum, this code function (that receive and execute)
Code: Select all
function w3all_ajaxup_from_phpbb(res){
var w3all_phpbbpmcount = /.*(#w3all_phpbbpmcount)=([0-9]+).*/ig.exec(res);
if(w3all_phpbbpmcount !== null){
w3all_ajaxup_from_phpbb_do(w3all_phpbbpmcount[2]);
}
}
has been rewrite into this (still not added in the advanced 1.6.9 tutorial how to and related code to copy):
Code: Select all
function w3all_ajaxup_from_phpbb(res){
var w3all_phpbb_u_logged = /#w3all_phpbb_u_logged=1/ig.exec(res);
if( res.indexOf('#w3all_phpbb_u_logged=') > -1 && w3all_phpbb_u_logged == null && null !== (document.getElementById('wp-admin-bar-my-account')) ){
window.location.reload(true);
}
var w3all_phpbbpmcount = /.*(#w3all_phpbbpmcount)=([0-9]+).*/ig.exec(res);
if(w3all_phpbbpmcount !== null){
w3all_ajaxup_from_phpbb_do(w3all_phpbbpmcount[2]);
}
} // END function w3all_ajaxup_from_phpbb(res){
the concept is clear, maybe it will changed little more before to be published also online.
This is effectively working already by the way, into this online example.