1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed valid condition reported as invalid

Discussion in 'Resolved Bug Reports' started by Jake Bunce, Mar 12, 2011.

  1. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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.
     
  2. Shadab

    Shadab Well-Known Member

    ...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>
     
  3. Mike

    Mike XenForo Developer Staff Member

    Fixed now. Looks like the code was missing a set of (...) around the regex, meaning that it matched at more than just the beginning.
     

Share This Page