Conditional Statements

Conditional Statements

Joe Blow

Active member
I am using a Recent Posts widget in a Widget Framework CMS style page:

screenshot-www.aussiestockforums.com-2017-12-13-08-43-00.png

My question is: How do I add a Conditional statement in the "Conditional" box that excludes all posts from the forum with the ID of 19?

Any help appreciated! :)
 

Brogan

XenForo moderator
Staff member
If that is from the third party add-on, you will need to post in the resource thread as I understand the syntax is different from XF.
 

valdet

Active member
@Brogan is there a conditional to check if there are posts by user X inside threads ?

I guess it needs to be combined with this conditional
Code:
<xen:if is="{$contentTemplate} == 'thread_view'">
This content will show on the thread_view template
</xen:if>
 

Mr Lucky

Well-known member
Is there a conditional to check if there are posts by user X inside threads ?

I guess it needs to be combined with this conditional
<xen:if is="{$contentTemplate} == 'thread_view'">
This content will show on the thread_view template
</xen:if>
Wouldn't you just use the search, or am I misunderstanding the question?
 

S Thomas

Well-known member
He probably wants to display a badge like "staff posts" or something similar.
@Brogan is there a conditional to check if there are posts by user X inside threads ?

I guess it needs to be combined with this conditional
Code:
<xen:if is="{$contentTemplate} == 'thread_view'">
This content will show on the thread_view template
</xen:if>
There is nothing like that, and, to be efficient, you should do this on the controller side. You can still build sth like this:
HTML:
<xen:set var="$containsMessage">false</xen:set>
<xen:foreach loop="$posts" value="$post">
            <xen:if is="{$post.user_id} == X">
                <xen:set var="$containsMessage">true</xen:set>
            </xen:if>
</xen:foreach>
{$containsMessage}
where X is the user you want
 

Ludachris

Well-known member
Need help with a conditional for CTA Featured Threads - I need a widget with New Threads with fewer than X replies. I already have the following conditional: {$contentTemplate} == 'cta_featuredthreads_featured'
 
Top