1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Script load before viewing thread page

Discussion in 'XenForo Development Discussions' started by TRACKMIXERS, Jun 23, 2012.



    I am using this code in my header template to block access to threads in certain forums.

    <xen:if is="in_array({$forum.node_id}, array(2,3)) AND {$controllerName} == 'XenForo_ControllerPublic_Thread' AND {xen:helper ismemberof, $visitor, 3}">MY SCRIPT HERE</xen:if>

    My question is, how can I get this to load before the thread page does? With my current setup the thread page will load about a second before the script so there is time to view it before the script loads.
  2. Jon W

    Jon W Well-Known Member

    You would have to make your script work the other way round... so you would add some CSS to make the thread invisible and then on all other threads, you would use a similar method to the above to add a script that would then make the thread visible (rather than the other way round). The thread would still be visible though if someone just looked at the source code for the page, and there is no way to stop that with a simple edit.

    A more elegant solution would surely be to just use node permissions?


    Thanks for the advice, Jon. I sent you a PM.

Share This Page