3

I want to test for the existence of disabled entries for the logged in author in a section. So far I have this:

{% set profileEntryQuery = craft.entries()
    .section('profileEntry')
    .status(null) %}

{% set entries = profileEntryQuery.all() %}    

{% for entry in entries %}

  {% if currentUser.id == entry.author.id %}

But the status(null) checks for disabled and enabled entries. How can I get a positive if only disabled entries exist but not enabled.

1 Answer 1

3

status('disabled') should do the trick for you 👌

{% set entries = craft.entries()
    .section('profileEntry')
    .status('disabled')
    .all() %}
4
  • Thanks it kind of does what I asked but doesn't quite do what I needed
    – Andrew
    Commented Feb 18, 2019 at 12:10
  • @Andrew sorry about that, what exactly do you need it do do? Not sure I follow completely...
    – Jalen Davenport
    Commented Feb 18, 2019 at 15:19
  • Not your fault, I started a new question to make it more explicit craftcms.stackexchange.com/questions/29556/…
    – Andrew
    Commented Feb 18, 2019 at 16:25
  • Gotcha; Robin's answer on that question is perfect 👍
    – Jalen Davenport
    Commented Feb 18, 2019 at 23:02

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.