<p>You should able to use <code>search</code> with <code>craft.users</code> something like this:</p>

<pre><code>craft.users.search('suspended: 1 lastLoginDate: NULL')
</code></pre>

<p>See the <a href="http://buildwithcraft.com/docs/searching" rel="nofollow">search docs</a> for more details.</p>

CC BY-SA 3.0
2015-06-08T10:43:29.287Z
Cheers for that, I'm not a massive fan of search for set things like this but this works too :)
Oli
CC BY-SA 3.0
2015-06-05T14:52:29.113Z
2015-06-05T14:52:29.113Z
Steve Rowling
<p>This probably works: <code>craft.users.status('suspended').lastLoginDate(':empty:')</code></p>

CC BY-SA 3.0
2015-06-08T10:31:08.193Z
Perfect, this works just as I wanted :)
Oli
CC BY-SA 3.0
2015-06-05T23:32:53.657Z
2015-06-05T23:32:53.657Z
carlcs
<p>This may sound paradoxal but here it is.</p>

<p>Membership based site. </p>

<p>A new user starts as suspended.
An admin unsuspends.</p>

<h2>The user uses the system.</h2>

<p>If a membership expires, a user gets suspended again (in the cp).</p>

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

<pre><code>craft.users.status('suspended').lastLoginDate(NULL)
craft.users.status('suspended').lastLoginDate('')
</code></pre>

<p>Neither of these work. Any light?</p>

<p>Doing this</p>

<pre><code>craft.users.status('suspended')
</code></pre>

<p>Then this in the actual loop works</p>

<pre><code> {% if user.lastLoginDate is null %}
</code></pre>

<p>I just wonder why I can't just fetch it all in one go :)</p>

<plugin-development><users><login>
Suspended users who have never logged in
# Suspended users who have never logged in

(Asked by: username_0 on 2015-06-05)

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 :)

**Tags:** plugin-development, users, login


---

## 2 answers

### Answer by username_2 on 2015-06-05. Score: 5 | Accepted answer

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

> **Comments:**
> **username_0**: Perfect, this works just as I wanted :)  

---

### Answer by username_1 on 2015-06-05. Score: 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.

> **Comments:**
> **username_0**: Cheers for that, I'm not a massive fan of search for set things like this but this works too :)  

---

