Tutorials Hide [Code] content from visitors !

Marks-Man

Administrator
Capture.PNG
Template:
bb_code_tag_code
Click to expand...


UPDATE
<xf:if is="in_array({$xf.reply.containerKey}, ['node-2', 'node-6']) AND $xf.visitor.isMemberOf([1])">
Click to expand...

<xf:macro template="prism_macros" name="setup" />

<div class="bbCodeBlock bbCodeBlock--screenLimited bbCodeBlock--code">
<div class="bbCodeBlock-title">
{{ $config.phrase ?: phrase('code') }}{$xf.language.label_separator}
</div>
<div class="bbCodeBlock-content" dir="ltr">

<xf:if is="$xf.visitor.isMemberOf([1])">
<code>
<b><a href="{{ link('login') }}" data-xf-click="overlay" data-follow-redirects="on"><i class="fas fa-sign-in-alt"></i> {{ phrase('log_in') }}</a></b>
or
<a href="{{ link('register') }}" data-xf-click="overlay" data-follow-redirects="on"><i class="fas fa-plus-square"></i> {{ phrase('register') }}</a>
</code>
<b>in order to view content</b>
<xf:else />
<pre class="bbCodeCode" dir="ltr" data-xf-init="code-block" data-lang="{{ $language ?: '' }}"><code>{$content}</code></pre>
</xf:if>
</div>
</div>
Click to expand...

Note: it can be done with BBCODES templates, unfortunately node forum numbers or pages are not working $page.node_id & in_array($__globals.forum.node_id, [42,43,58])
Click to expand...


UPDATE:

On XenForo 2.2.4
<xf:if is="$xf.reply.containerKey == 'node-6'">
Click to expand...
Multiple Nodes
<xf:if is="in_array({$xf.reply.containerKey}, ['node-2', 'node-6'])">
Click to expand...

In Resource Manager
$xf.reply.containerKey == 'xfrmCategory-3'
Click to expand...

Continue reading...
 
Top