page-forum - Preloader loop

User avatar
axew3
w3all User
w3all User
Posts: 2704
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: page-forum - Preloader loop

Post by axew3 »

Uncaught TypeError: e.indexOf is not a function
load jQuery
<anonymous> https://armyranger.com/bb/index.php:2021
i assume that this error cause your problem: it make it fail the subsequent forum's page jquery instruction that should remove the preloader (it is not a loop).

So to resolve, you can do two things:
resolve the js error coming out due to a wp plugin or wp theme or wp theme plugin, or into phpBB template, like it is in your case, or remove the preloader into page forum for the moment: just open it and remove this code:

search:

Code: Select all

<!-- START iframe div -->
<div id="w3_toogle_wrap_loader" class="w3_no_wrap_loader"><div class="w3_loader"></div></div>
remove the line

Code: Select all

<div id="w3_toogle_wrap_loader" class="w3_no_wrap_loader"><div class="w3_loader"></div></div>
.

But so you'll not have a preloader.

The page-forum js code will be updated to fix issues like these: if there are errors coming out due to some code in wp plugins/themes or phpBB templates, it will work by the way.

I would like to remember also that disabling js on browser, you can stop any issue with javascript, so you can manage and adjust things, if you fall into problems with iframe and preloader that do not disappear.
oferlaor
User w
User w
Posts: 10
Joined: Wed Jan 27, 2021 2:24 pm

Re: page-forum - Preloader loop

Post by oferlaor »

this is what I did on my site:

Code: Select all

jQuery(window).on('DOMContentLoaded', function(){
	setTimeout(function(){
	 jQuery('#w3_toogle_wrap_loader').attr( \"class\", \"w3_no_wrap_loader\" );
	},500);
});
jQuery(window).on('load', function(){
 jQuery('#w3_toogle_wrap_loader').attr( \"class\", \"w3_no_wrap_loader\" );
});
About the loop, this can be caused by two reasons, either the window.top doesn't stick or the login sync doesn't work (phpbb thinks it's logged in but the login doesn't stick because of a mismatch between WP & phpbb login credentials).


for the first in overall_header.php:

Code: Select all

if ((window.self !== window.top) != true) {
		if(/adm\//ig.exec(window.location.href) === null){ // avoid x ACP
			var w3all_r = window.location.href.replace(/sid=.+/gi, '');
			w3all_r = w3all0Normalize_phpBBUrl(w3all_r);
			hrefEnc = window.btoa(unescape(encodeURIComponent(w3all_r)));
			href0 =  wordpress_url_page_f + '/?'+ w3all_custom_wp_w3fancyurl + '=' + hrefEnc;
			if (document.location.href!= href0)
				document.location.replace(href0);
		}
	}
for the second case in page-forum.php, note the protection that's supposed to prevent the loop. The issue is likely caused when there's a mismatch between phpbb & WP credentials, it might be smarter to redirect to recommit the login info into WP, since it's like that's the root cause for the loop:

Code: Select all

	function w3all_ajaxup_from_phpbb(res, hash = ''){
            function reloadPage() {
                document.location.reload();
            }
            function redirectToForum() {
                        // no one will use the index.php notation naturally, but we can also add another notation
			if (document.location.href!= ($w3allhomeurl."/index.php/".$wp_w3all_forum_folder_wp))
				document.location.replace('".$w3allhomeurl."/index.php/".$wp_w3all_forum_folder_wp."/');
            }
            function showLoader() {
                jQuery('#w3_toogle_wrap_loader').attr( \"class\", \"w3_wrap_loader\" );
            }
            
          var w3all_phpbb_u_logged  = /#w3all_phpbb_u_logged=1/ig.exec(res);

          if( w3all_phpbb_u_logged == null && wp_u_logged > 0 ||
            wp_u_logged == 0 && res.indexOf('#w3all_phpbb_u_logged=1') > -1 ){
             showLoader();
             
             if( hash == 'unread' ){
                reloadPage(); //no need to redirect to forum homepage
             } else {
                reloadPage();
             }
          } else if (wp_u_logged == 0 && res.indexOf('#w3all_phpbb_u_logged=1') > -1){
            redirectToForum()
          }
User avatar
DjPorkchop73
User www
User www
Posts: 80
Joined: Thu Aug 20, 2020 6:45 pm
Location: Egyptian Valley of Illinois

Re: page-forum - Preloader loop

Post by DjPorkchop73 »

I upgraded and no matter what I do, I get the preloader loop. I have tried everything I can think of. If anyone has any ideas at all, I am all ears. I even tried the test above to see if the loop went away and it did not while the preloader did.

I removed :

Code: Select all

<div id="w3_toogle_wrap_loader" class="w3_no_wrap_loader"><div class="w3_loader"></div></div>
Still have a loop.

My website is setup the old way so Wordpress Admin and phpBB admin match. I shutoff profile options in phpBB and only allow registration and login in phpBB.

If I turn java off in my browser, the loop is gone and website works normal except obviously I have no iframe integration at that point.
If I could I would. If I don't, it's because I am lazy!

"Don't gain the world and lose your soul, wisdom is better than silver and gold" -Bob Marley
User avatar
axew3
w3all User
w3all User
Posts: 2704
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: page-forum - Preloader loop

Post by axew3 »

Ok: i will stop a while today the extension audio/video to post, to take a look into this and i hope to find out the main problem immediately.
i will report soon the result here. Anyway:

Code: Select all

<div id="w3_toogle_wrap_loader" class="w3_no_wrap_loader"><div class="w3_loader"></div></div>
the fact you say
Still have a loop until i do not disable the javascript on browser results to me very strange.
let see...
User avatar
DjPorkchop73
User www
User www
Posts: 80
Joined: Thu Aug 20, 2020 6:45 pm
Location: Egyptian Valley of Illinois

Re: page-forum - Preloader loop

Post by DjPorkchop73 »

axew3 wrote: Wed Feb 17, 2021 8:29 am Ok: i will stop a while today the extension audio/video to post, to take a look into this and i hope to find out the main problem immediately.
i will report soon the result here. Anyway:

Code: Select all

<div id="w3_toogle_wrap_loader" class="w3_no_wrap_loader"><div class="w3_loader"></div></div>
the fact you say
Still have a loop until i do not disable the javascript on browser results to me very strange.
let see...
I continued to work on it tonight. I am putting it back to the way it was right after i upgraded the website. I fear the harder I try the worse I make it. So I will take it back to as was after the upgrade so it is fresh so I can try a clean problem solve with you. I appreciate you thinking about a solution.
If I could I would. If I don't, it's because I am lazy!

"Don't gain the world and lose your soul, wisdom is better than silver and gold" -Bob Marley
User avatar
DjPorkchop73
User www
User www
Posts: 80
Joined: Thu Aug 20, 2020 6:45 pm
Location: Egyptian Valley of Illinois

Re: page-forum - Preloader loop

Post by DjPorkchop73 »

I did forget to add, When I visit the website for the first time as not logged in, when I visit the phpBB forum, I do not loop. When I click the login link and enter my credentials and submit, I then enter the endless loop. no matter what I do after that, I can not stop it. I also double checked the Remember Me setting, The forced SSL settings, I double and triple checked my cookie settings as well.

If I can be fast and catch a link on the website and click it fast enough, I can get back on the phpBB and I am logged in. However, if I attempt to leave the phpBB at all, I then loop once again. I can never make it to the WordPress. If I manage to click a WordPress link fast enough while in the loop, I can get to WordPress then, but I am NOT logged in.

If I get rid of the iframe integration and use the force integration trick instead, I have no issues at all with the plugin.
If I could I would. If I don't, it's because I am lazy!

"Don't gain the world and lose your soul, wisdom is better than silver and gold" -Bob Marley
Post Reply