Script load before viewing thread page

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.
 
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?
 
Top Bottom