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()
    .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.


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

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

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.