Hey,

I recently had to build a section of a page that displays voucher codes assigned to users. If a user is logged in, he should be able to see the most recent code assigned to him. I solved it like this:

{{ entries:listing folder="codes" }}
    {{ codes }}
        {{ if username === user }}
            <div class="doc_voucher">
                <h4>Ihr Code</h4>
                <div class="doc_code">{{ code }}</div>
            </div>
        {{ /if }}
    {{ /codes }}
{{ /entries:listing }}

Problem: The codes are handed out in badges and one user could get a code in two different badges of codes. Is there a way to print out the code only the first time the if statement comes true? I currently solve this with some first-child in CSS which is suboptimal.

Thanks!