Joe Link
Well-known member
![]()
Conditional Statements for XenForo 2
googletag.pubads().setTargeting('VisitorID', '{$xf.visitor.user_id}');xenforo.com
Thank you!!
![]()
Conditional Statements for XenForo 2
googletag.pubads().setTargeting('VisitorID', '{$xf.visitor.user_id}');xenforo.com
<xf:macro name="thread_status" arg-thread="!" arg-wrapperClass="">
    <xf:if contentcheck="true">
        <div class="{$wrapperClass}">
            <dl class="blockStatus">
                <dt>{{ phrase('status') }}</dt>
                <xf:contentcheck>
                    <xf:if is="$thread.discussion_state == 'deleted'">
                        <dd class="blockStatus-message blockStatus-message--deleted">
                            <xf:macro template="deletion_macros" name="notice" arg-log="{$thread.DeletionLog}" />
                        </dd>
                    <xf:elseif is="$thread.discussion_state == 'moderated'" />
                        <dd class="blockStatus-message blockStatus-message--moderated">
                            {{ phrase('awaiting_approval_before_being_displayed_publicly') }}
                        </dd>
                    </xf:if>
                    <xf:if is="!$thread.discussion_open">
                        <xf:if is="{{ in_array($forum.Node.parent_node_id, ['20','55']) }}">
                            <dd class="blockStatus-message blockStatus-message--locked">
                                {{ phrase('custom_thread_closed') }}
                            </dd>
                        <xf:else />    
                            <dd class="blockStatus-message blockStatus-message--locked">
                                {{ phrase('not_open_for_further_replies') }}
                            </dd>
                        </xf:if>    
                    </xf:if>
                </xf:contentcheck>
            </dl>
        </div>
    </xf:if>
</xf:macro>
	                    <xf:if is="!$thread.discussion_open">
                        <xf:if is="{{ in_array($forum.Node.parent_node_id, ['20','55']) }}">
                            <dd class="blockStatus-message blockStatus-message--locked">
                                {{ phrase('custom_thread_closed') }}
                            </dd>
                        <xf:else />    
                            <dd class="blockStatus-message blockStatus-message--locked">
                                {{ phrase('not_open_for_further_replies') }}
                            </dd>
                        </xf:if>    
                    </xf:if>
	Is there a statement to check if a post is from an admin?
Somthing like $post.isAdmin maybe?
<xf:if is="$post.User.is_admin">
     //Code
</xf:if>
	Works, ty very muchUntested, but try this:
<xf:if is="$forum.node_id == 58">
    Show content..
</xf:if>
	<xf:macro template="{$nodeTemplate.template}" name="{$nodeTemplate.macro}"
            arg-node="{$node}"
            arg-extras="{$extras}"
            arg-children="{$children}"
            arg-childExtras="{$childExtras}"
            arg-depth="{$depth}" />
                    <xf:if is="$forum.node_id == 58">
               Show content..
</xf:if>
    <xf:elseif is="{$nodeTemplate.template}" />
        <xf:include template="{$nodeTemplate.template}" />
    </xf:if>
</xf:macro>
	what about not show in multiple template?
thanks for your help, you are so awesomeFor exemple:
<xf:if is="!in_array({$template}, ['forum_list', 'forum_view', 'thread_view'])">
Bla-bla-bla
</xf:if>
44. How do I hide content in multiple forums?
...
Change this to
Code:<xf:if is="!in_array($forum.node_id, [x,y,z])"> Hide content.. </xf:if>
Need this working in a Widget, but it wont work for me.
Code:<xf:if is="!in_array($__globals.forum.node_id, [5,6,7,8])">

What aboutNeed this working in a Widget, but it wont work for me.
Code:<xf:if is="!in_array($__globals.forum.node_id, [5,6,7,8])">
<xf:if is="!in_array($forum.node_id, [5,6,7,8])">
	arg-forum="{$forum}" when you call thread_list_macros in widget template.We use essential cookies to make this site work, and optional cookies to enhance your experience.