Forum constantly reloads when not logged in.

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Forum constantly reloads when not logged in.

Re: Forum constantly reloads when not logged in.

by axew3 » Sat May 16, 2020 4:25 pm

default addons/page-forum.php file on plugin repository has been patched to resolve definitively this issue, as said above, it substitute this line of code:

Code: Select all

var wp_u_logged = ".$current_user->ID.";
with this:

Code: Select all

var wp_u_logged = ".get_current_user_id().";
i assume the wrong result may was given by the previous code, on different Php versions. It do not return the same into my tests

Re: Forum constantly reloads when not logged in.

by axew3 » Fri May 15, 2020 2:49 pm

open page-forum.php and where this line:

Code: Select all

var wp_u_logged = ".$current_user->ID.";
change with this:

Code: Select all

var wp_u_logged = ".get_current_user_id().";
it is better to change this line by default because it return a strange result i see (and fortunately it is was not affecting any security issue. Imagine a result that should be 0 that return 1 instead) WoW
Please let know asap

Re: Forum constantly reloads when not logged in.

by axew3 » Fri May 15, 2020 2:42 pm

mhh ... i see a strange thing into your page forum, that let me think php versions can may interfere, so a fix should be applied maybe-
Your wp, i see that even if my user is not logged in, the function wp_get_current_user(); return 1.
This cause the loop, because the user is not really logged instead into phpBB, nor in wp. Then the iframe loop.
let me check the solution

Re: Forum constantly reloads when not logged in.

by Nighty » Thu May 14, 2020 5:12 pm

Hm.

A guildie pointed out to me that the site (forum) seems to be back on a reload loop after the design changes, so kind of back to square one.
Got an idea about what's going on there?

As the site is now, when not logged in.

Re: Forum constantly reloads when not logged in.

by axew3 » Thu May 14, 2020 9:34 am

Nighty wrote:
Thu May 14, 2020 6:46 am
-- Just some sizing issues
So you may will take a look into this to resolve definitively any resizer issue
viewtopic.php?p=4505#p4505

Re: Forum constantly reloads when not logged in.

by Nighty » Thu May 14, 2020 6:46 am

I've updated the theme we're using (Hestia), which was a couple of versions behind - mainly due to my changes - However, the "Gutenberg" thing was kind of broke, so had to :p

Forum looks, in my opinion, better now, as in: it looks more like it belongs to the page -- Just some sizing issues, it's cutting off the bottom of the forum. I'll look into that later, it's about time I get some sleep :P

I'll look into the js error when I get back up.

Thanks for the help!

Re: Forum constantly reloads when not logged in.

by axew3 » Sat May 02, 2020 9:21 am

Ehy! Just gave a try, i registered alias. All seem to work perfect, by the way, i see a js error on console, coming out into your wordpress theme header, a js function that cause this:

Code: Select all

TypeError: document.getElementById(...) is null forum:421:54
    resizeIframe https://www.nylaathria.dk/forum/:421
    callResize https://www.nylaathria.dk/nyl/viewforum.php?f=13:868
but this is NOT the iframe resizer of the plugin, it is from your wp theme, you should resolve this that output into wordpress page-forum causing the js error where dynheight return a null value on page-forum (it output into wordpress header)

Code: Select all

<script type="text/javascript">
//   reSize Iframe when ever child  calls  it
function resizeIframe(dynheight)
        {
            document.getElementById("iforum").height=parseInt(dynheight)+10;
        }
 
</script>
this can be resolved in various ways, first of all may detecting why this function called in this case (on page -forum) return a null value for the passed
dynheight var

Re: Forum constantly reloads when not logged in.

by Nighty » Fri May 01, 2020 7:56 pm

Not sure if I see a "Edit" button - So I do apologise for possibly missing it.

Anyhow, I moved the site to https://www.nylaathria.dk/forum/ - Live now.
Still working on it however. :D

Re: Forum constantly reloads when not logged in.

by Nighty » Fri May 01, 2020 11:56 am

Right! I found / remember some of the reasons behind my changes now.

Atm I've set it up here: https://www.nylaathria.dk/nylv5/forum/

However, the top is missing (menu, lack of some sort of margin-top), as well as just keeping the top layout (gap).
The page loads too far down (auto-scrolls?).
And, the page layout is dropped - the left-side boxes are dropped (Recruitment/Progression).

Which is why I tried to do the iframe idea downstairs, basically just copying the parts into a page (I think I got the idea from somewhere on your site? But it's been so long that I'm unsure now). The iframe idea kept the site's layout, but caused the constant page reloading while not being logged in.

Any ideas, thoughts?

Thanks,
Nighty

Re: Forum constantly reloads when not logged in.

by Nighty » Fri May 01, 2020 11:34 am

First off - I apologise for the slow slow reply. Been a bit going on.

Anyhow, the code I followed at the time should've been all up-to-date, and I did do the iframeResizer.contentWindow.min.js as well.

Am guessing it might be due to the way I integrated the thing, which is essentially just copying over the iFrame data, as doing the rebuild resulted in the page not working at all - as in, am guessing that the theme I use doesn't quite work with the "normal" way of doing things (Using Hestia).


However, it has been a fair bit of time since last, and you've certainly done some updates, and I've got some time now to work on our new page -- so, I'll mess about with it some, make sure everything is updated to your last codes, and then I'll get back to you - thanks for the replies! :)

Code: Select all

<!-- START iframe div -->
<div id="w3_toogle_wrap_loader" class="w3_no_wrap_loader"><div class="w3_loader"></div></div>
<div class="">
<noscript><h3>It seem that your browser have Javascript disabled: you can't load the forum page at this Url. Please enable Javascript on your browser or <a href="https://www.nylaathria.dk/nyl/index.php">visit the forum here</a>.<br><br></h3></noscript>
<iframe id="w3all_phpbb_iframe" style="width: 1px; min-width: 100%; border: 0px; overflow: hidden; height: 1494px;" scrolling="no" src="https://www.nylaathria.dk/nyl/index.php"></iframe>
<script type="text/javascript">
		document.domain = 'nylaathria.dk';
		// document.domain = 'mydomain.com'; // NOTE: reset/setup this with domain if js error when WP is installed like on mysite.domain.com and phpBB on domain.com: js origin error can come out for example when WordPress is on subdomain install and phpBB on domain. The origin fix is needed: (do this also on phpBB overall_footer.html added code)
		var wp_u_logged = 1;
		
		function w3all_ajaxup_from_phpbb(res){
			var w3all_phpbb_u_logged  = /#w3all_phpbb_u_logged=1/ig.exec(res);
			 if( w3all_phpbb_u_logged == null && wp_u_logged > 0  ){
			 document.location.replace('https://www.nylaathria.dk/nylv5/index.php/forum/');
       }
       if(wp_u_logged == 0 && res.indexOf('#w3all_phpbb_u_logged=1') > -1){
       document.location.replace('https://www.nylaathria.dk/nylv5/index.php/forum/');
       }
       
			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){
     
    iFrameResize({
				log                     : false,
				inPageLinks             : true,
        targetOrigin: 'https://www.nylaathria.dk/nyl/index.php', 
        checkOrigin : 'nylaathria.dk', // if js error: 'Failed to execute 'postMessage' on 'DOMWindow': The target origin provided does not match the recipient window's origin. Need to fit YOUR domain, ex: mydomain.com
     // heightCalculationMethod: 'documentElementOffset', // If iframe not resize correctly, un-comment (or change with one of others available resize methods) 
     // see: https://github.com/davidjbradshaw/iframe-resizer#heightcalculationmethod
       
				messageCallback : function(messageData){ // Callback fn when message is received 	
	   
				// w3all simple js check and redirects
				var w3all_passed_url = messageData.message.toString();
			  var w3all_ck = "www.nylaathria.dk";
        var w3all_pass_ext  = (w3all_passed_url.indexOf(w3all_ck) > -1);    
        var w3all_ck_preview = (w3all_passed_url.indexOf('preview') > -1);

if (w3all_ck_preview == false) { // or the phpBB passed preview link, will be recognized as external, and preview will redirect to full forum url instead
 // so these are maybe, external iframe redirects
    if (w3all_pass_ext == true) {
     	window.location.replace(w3all_passed_url); 
     }
    if (/^(f|ht)tps?:\/\//i.test(w3all_passed_url)) {
      window.location.replace(w3all_passed_url); 
    }
}

// security: do not pass to be encoded an url with sid or if point to phpBB admin ACP via iframe
if( /[^-0-9A-Za-z\._#\:\?\/=&%]/ig.exec(w3all_passed_url) !== null || /adm\//ig.exec(w3all_passed_url) !== null || /sid=/ig.exec(w3all_passed_url) !== null ){
	w3all_passed_url = '';
}
// PUSH phpBB URLs //
w3all_passed_url = window.btoa(unescape(encodeURIComponent(w3all_passed_url)));
w3all_passed_url_push = 'https://www.nylaathria.dk/nylv5/forum/?w3=' + w3all_passed_url;
history.pushState({w3all_passed_url: w3all_passed_url}, "Forum", w3all_passed_url_push);
}
});

</script></div>
<!-- END iframe div -->

Top