Answers.Body: <p>There's no <code>photo</code> attribute on the UserElementType, so you can't query by it like you're trying.</p>
  
  <p>Completely untested, but you can probably work around that with something like this:</p>
  
  <pre><code>{% if geslacht_param_string !=''  %}
  
  {% set queryParams = {
      search: {
          query: geslacht_param_string,
          attribute: 'geslacht'               
      },
      geboortedatum : dateRange,
      order :'lastName',
  } %}
  
  {% else %}
      {% set queryParams = {
          geboortedatum : dateRange,
          order :'lastName',
      } %}
  {% endif %}
  
  {% set allUsers = craft.users(queryParams).find() %}
  
  {% set usersWithPhotos = [] %}
  
  {% for user in allUsers %}
      {% if user.photo %}
          {% set usersWithPhotos = usersWithPhotos|merge([user]) %}
      {% endif %}
  {% endfor %}
  
  There are {{ usersWithPhotos|length }} users with photos.
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-13T09:26:55.780Z
Answers.Text: Thanks for the answers, I'll test it ASAP. On a sidenote: the site has about 600 members, won't this slow down the site a lot?
Answers.UserDisplayName: Jan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-14T03:48:55.990Z
Answers.Text: Possible... I'd definitely do some testing. If it's bad, look into using a [template hook](https://craftcms.com/classreference/services/TemplatesService#hook-detail) and a plugin.  You can query the database via query builder directly from PHP and cache the results assuming they won't change a lot.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-12T20:15:56.853Z
Answers.LastActivityDate: 2016-05-12T20:15:56.853Z
Answers.UserDisplayName: Brad Bell
Body: <p>I'm working on a site that has logins for members, but I'd like to have a page that shows all members with a name and picture.
  To do this, we had to import an existing database that doesn't have a lot of profile pics. Now I want to hide all users that have no picture uploaded. </p>
  
  <p>This is the code I'm trying, but with no luck...</p>
  
  <pre><code>{% if geslacht_param_string !=''  %}
  
  {% set queryParams = {
      search: {
          query: geslacht_param_string,
          attribute: 'geslacht'               
      },
      geboortedatum : dateRange,
      order :'lastName',
      photo : ':notempty:'
  } %}
  
  {% else %}
      {% set queryParams = {
          geboortedatum : dateRange,
          order :'lastName',
          photo : ":notempty:"
      } %}
  {% endif %}
  
  {% set leden = craft.users(queryParams) %}
  </code></pre>
  
  <p>I can't find the decent syntax for <code>:notempty:</code>, can anyone help me out here? Thanks a lot!</p>
  
Tags: <users><ordering>
Title: Hide users without profile pics
ThreadText: # Hide users without profile pics
  
  (Asked by: username_0 on 2016-05-12)
  
  I'm working on a site that has logins for members, but I'd like to have a page that shows all members with a name and picture.
  To do this, we had to import an existing database that doesn't have a lot of profile pics. Now I want to hide all users that have no picture uploaded.
  
  This is the code I'm trying, but with no luck...
  
  ```
  {% if geslacht_param_string !=''  %}
  
  {% set queryParams = {
      search: {
          query: geslacht_param_string,
          attribute: 'geslacht'               
      },
      geboortedatum : dateRange,
      order :'lastName',
      photo : ':notempty:'
  } %}
  
  {% else %}
      {% set queryParams = {
          geboortedatum : dateRange,
          order :'lastName',
          photo : ":notempty:"
      } %}
  {% endif %}
  
  {% set leden = craft.users(queryParams) %}
  
  ```
  
  I can't find the decent syntax for `:notempty:`, can anyone help me out here? Thanks a lot!
  
  **Tags:** users, ordering
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-05-12. Score: 2
  
  There's no `photo` attribute on the UserElementType, so you can't query by it like you're trying.
  
  Completely untested, but you can probably work around that with something like this:
  
  ```
  {% if geslacht_param_string !=''  %}
  
  {% set queryParams = {
      search: {
          query: geslacht_param_string,
          attribute: 'geslacht'               
      },
      geboortedatum : dateRange,
      order :'lastName',
  } %}
  
  {% else %}
      {% set queryParams = {
          geboortedatum : dateRange,
          order :'lastName',
      } %}
  {% endif %}
  
  {% set allUsers = craft.users(queryParams).find() %}
  
  {% set usersWithPhotos = [] %}
  
  {% for user in allUsers %}
      {% if user.photo %}
          {% set usersWithPhotos = usersWithPhotos|merge([user]) %}
      {% endif %}
  {% endfor %}
  
  There are {{ usersWithPhotos|length }} users with photos.
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks for the answers, I'll test it ASAP. On a sidenote: the site has about 600 members, won't this slow down the site a lot?  
  > **username_1**: Possible... I'd definitely do some testing. If it's bad, look into using a [template hook](https://craftcms.com/classreference/services/TemplatesService#hook-detail) and a plugin.  You can query the database via query builder directly from PHP and cache the results assuming they won't change a lot.  
  
  ---
  
  