XF 1.4 How do i make it so Spoiler only works for registered guests?

Martyn

Active member
Been trying to make it so that Spoil bbcode will only work for registered guest, but it seems that anyone can click it..

Anyone know how to tweak this?

many thanks
 
If you edit the bbcode_spoiler_tag template to this:

find:
HTML:
<div class="ToggleTriggerAnchor bbCodeSpoilerContainer">
   <button class="button bbCodeSpoilerButton ToggleTrigger Tooltip JsOnly"
     title="{xen:phrase click_to_reveal_spoiler}"
     data-target="> .SpoilerTarget"><span>{xen:phrase spoiler}{xen:if $titleHtml, ': <span class="SpoilerTitle">{xen:raw $titleHtml}</span>'}</span></button>
   <div class="SpoilerTarget bbCodeSpoilerText">{xen:raw $content}</div>
</div>

replace:

HTML:
<xen:if is="{$visitor.user_id}">
<div class="ToggleTriggerAnchor bbCodeSpoilerContainer">
   <button class="button bbCodeSpoilerButton ToggleTrigger Tooltip JsOnly"
     title="{xen:phrase click_to_reveal_spoiler}"
     data-target="> .SpoilerTarget"><span>{xen:phrase spoiler}{xen:if $titleHtml, ': <span class="SpoilerTitle">{xen:raw $titleHtml}</span>'}</span></button>
   <div class="SpoilerTarget bbCodeSpoilerText">{xen:raw $content}</div>
</div>
<xen:else />
<button class="button" title="{xen:phrase click_to_reveal_spoiler}"><span>You need to register to view spoilers!</span></button>
</xen:if>

It should work :)
 
one last thing @Liam W anyway to make it say the spoiler title?

E.g rather then you need to register to view spoiler, could I make it say you need to register to view Title, an if no title then spoiler?

Actually wondering now if I should have made another BBcode for this lol
 
actually would it be easy to make a new bbcode similar to spoiler? just to hide a download link from guests? that way I could keep the spoiler tag in tact
 
actually would it be easy to make a new bbcode similar to spoiler? just to hide a download link from guests? that way I could keep the spoiler tag in tact

That is possible, but it would have to have a php callback to have it render as a template (if the custom bbcode system is used).

Liam
 
Would the template be the same? would everything have spoiler in it or can I customize that in the template settings?

Maybe ill have to keep it like this with the default spoiler just so guests can't view it,

Thanks for your time an help @Liam W
 
Top Bottom