Fixed  valid condition reported as invalid

Jake Bunce

XenForo moderator
Staff member
#1
Regarding this post:

http://xenforo.com/community/threads/recent-activity-stream-not-show-likes.13470/#post-176948

Edit this template:

Admin CP -> Appearance -> Templates -> news_feed_item

When I was testing conditions I at one point used this condition:

Code:
<xen:if is="{$item.action} != 'like' OR true">

<li id="item_{$item.news_feed_id}" class="event primaryContent NewsFeedItem" data-author="{$item.username}">

	<xen:avatar user="$item" size="s" class="icon" />
	
	<div class="content">		
		{xen:raw $itemTemplate}
		
		<xen:datetime time="{$itemDate}" />
	</div>
</li>

</xen:if>
This condition is valid but when I save the template I get this error:

Screen shot 2011-03-12 at 10.36.16 AM.png

However, when I use 1 instead of true it works:

Code:
<xen:if is="{$item.action} != 'like' OR 1">

<li id="item_{$item.news_feed_id}" class="event primaryContent NewsFeedItem" data-author="{$item.username}">

	<xen:avatar user="$item" size="s" class="icon" />
	
	<div class="content">		
		{xen:raw $itemTemplate}
		
		<xen:datetime time="{$itemDate}" />
	</div>
</li>

</xen:if>
The true and false keywords work fine in other conditions I have tested. This appears to be a special case.
 

Shadab

Well-known member
#2
...And for some strange reason if you reverse the order of conditions, it compiles just fine.
Code:
<xen:if is="true OR {$item.action} != 'like'">
	Foo
</xen:if>
 

Mike

XenForo developer
Staff member
#3
Fixed now. Looks like the code was missing a set of (...) around the regex, meaning that it matched at more than just the beginning.
 
Top