6

This may sound paradoxal but here it is.

Membership based site.

A new user starts as suspended. An admin unsuspends.

The user uses the system.

If a membership expires, a user gets suspended again (in the cp).

I want (in the cp again, from a plugin) a list of of suspended users who have never logged in. New users basically...

craft.users.status('suspended').lastLoginDate(NULL)
craft.users.status('suspended').lastLoginDate('')

Neither of these work. Any light?

Doing this

craft.users.status('suspended')

Then this in the actual loop works

 {% if user.lastLoginDate is null %}

I just wonder why I can't just fetch it all in one go :)

0
5

This probably works: craft.users.status('suspended').lastLoginDate(':empty:')

1
  • Perfect, this works just as I wanted :)
    – Oli
    Jun 8 '15 at 10:31
2

You should able to use search with craft.users something like this:

craft.users.search('suspended: 1 lastLoginDate: NULL')

See the search docs for more details.

1
  • Cheers for that, I'm not a massive fan of search for set things like this but this works too :)
    – Oli
    Jun 8 '15 at 10:43

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.