0

Does anyone know how I can show a specific entry to a user (frontend)? My user field is called "gebruiker".

{# Get current member e.g URL /members/1/ #}
{% set currentMember = craft.users.id(craft.request.segment(2)).first() %}

{# Get current members test entries #}
{% set currentMemberTest = craft.entries.section('test').relatedTo({
    targetElement: currentMember,
    field: 'gebruiker',
}) %}

{% for entry in craft.entries.section('test').find() %}
    <div class="container">
        <div class="row">
            <div class="col-md-6">
                <h3><a href="{{ entry.url }}">{{ entry.title }}</a></h3>
            </div>
        </div>
    </div>
{% endfor %}

Thanks

2

Instead of looping through currentMemberTest, you're currently setting up a fresh criteria model in your for loop.

Use your nicely set currentMemberTest criteria!

{% for entry in currentMemberTest %}
    ...
{% endfor %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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