0

I need to be able to display only a subset of channel entries based on membership expiration date.

I am looking to display only those entries where the Expiration Date is less than or equal to today.

Here is the code:

{exp:channel:entries channel="member_profiles" group_id="9|10|11|12|13|14|15"  orderby="business_expire_date" sort="asc"}
 {if {business_expire_date format="%U"} <= {current_time format="%U"} }
    <tr class="{switch='odd|even'}">
        <td><a href="/member-reports/profile/{url_title}">{member_business}</a></td>
        <td>{full_name}</td>
        <td>{business_enroll_date format="%M %d, %Y"}</td>
        <td class="expired"> {business_expire_date format="%M %d, %Y"}</td>
    </tr>
    {/if}
{/exp:channel:entries}

When I load the page I get the following error:

Parse error: syntax error, unexpected T_IS_SMALLER_OR_EQUAL in /home/...

How do I modify the {if} statement to correct that?

Thanks.

3
  • What if you wrap your dates in quotes? ie. {if "{business_expire_date format='%U'}" ... Commented Jun 6, 2013 at 21:13
  • Hi Jason, that helped. I had to get rid of the formatting too and now it works fine. Please elevate your comment to a response and I'll give you credit for it.
    – forrest
    Commented Jun 6, 2013 at 21:18
  • Much appreciated! Commented Jun 6, 2013 at 21:52

1 Answer 1

3

You should wrap your dates in quotes.

{if "{business_expire_date}" <= "{current_time}"}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.