Conditional Statements

Conditional Statements

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

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

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! :)
 
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.
 
@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>
 
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?
 
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
 
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'
 
Anyone know a way to insert a conditional into a widget so it doesn't display on small devices, only larger devices? I'm aware I could wrap content into a div with a class, but these specific widgets are from addons, not custom.

Thanks!
 
how i can port this to xf 1.5 ?

2.x

PHP:
<xf:if is="$xf.visitor.isMemberOf([x,y]) || !in_array($__globals.forum.node_id, [x,y])">

1.5.x

PHP:
<xen:if is="{xen:helper ismemberof, $visitor, x, y} || !in_array({$forum.node_id}, array(x, y))">

this correct ?
 
Last edited:
Top Bottom