|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Bug396a; |
| 4 | + |
| 5 | +function () { |
| 6 | + $query = \Drupal::entityQuery('user') |
| 7 | + ->condition('status', 1) |
| 8 | + ->condition('uid', 1, '<>') |
| 9 | + ->condition('field_profile_visibility', 1) |
| 10 | + ->condition('field_account_type', '', '<>') |
| 11 | + ->condition('field_last_name.value', '', '<>'); |
| 12 | + if( isset($qparam['expertise']) && !empty($qparam['expertise']) ) { |
| 13 | + $query->condition('field_field_expertise.entity.tid', $qparam['expertise']); |
| 14 | + } |
| 15 | + if( isset($qparam['origin']) && !empty($qparam['origin']) ) { |
| 16 | + $query->condition('field_place_origin.entity:taxonomy_term.field_country_tags', $qparam['origin']); |
| 17 | + } |
| 18 | + if( isset($qparam['place_residence']) && !empty($qparam['place_residence']) ) { |
| 19 | + $query->condition('field_place_residence.entity:taxonomy_term.field_country_tags', $qparam['place_residence']); |
| 20 | + } |
| 21 | + if( isset($qparam['city']) && !empty($qparam['city']) ) { |
| 22 | + $query->condition('field_city', $qparam['city'], 'CONTAINS'); |
| 23 | + } |
| 24 | + if( isset($qparam['user_type']) && !empty($qparam['user_type']) ) { |
| 25 | + $query->condition('field_account_type.entity.tid', $qparam['user_type']); |
| 26 | + } |
| 27 | + $users = $query->execute(); |
| 28 | +}; |
| 29 | +function () { |
| 30 | + $query = \Drupal::entityQuery('user') |
| 31 | + ->accessCheck(FALSE) |
| 32 | + ->condition('status', 1) |
| 33 | + ->condition('uid', 1, '<>') |
| 34 | + ->condition('field_profile_visibility', 1) |
| 35 | + ->condition('field_account_type', '', '<>') |
| 36 | + ->condition('field_last_name.value', '', '<>'); |
| 37 | + if( isset($qparam['expertise']) && !empty($qparam['expertise']) ) { |
| 38 | + $query->condition('field_field_expertise.entity.tid', $qparam['expertise']); |
| 39 | + } |
| 40 | + if( isset($qparam['origin']) && !empty($qparam['origin']) ) { |
| 41 | + $query->condition('field_place_origin.entity:taxonomy_term.field_country_tags', $qparam['origin']); |
| 42 | + } |
| 43 | + if( isset($qparam['place_residence']) && !empty($qparam['place_residence']) ) { |
| 44 | + $query->condition('field_place_residence.entity:taxonomy_term.field_country_tags', $qparam['place_residence']); |
| 45 | + } |
| 46 | + if( isset($qparam['city']) && !empty($qparam['city']) ) { |
| 47 | + $query->condition('field_city', $qparam['city'], 'CONTAINS'); |
| 48 | + } |
| 49 | + if( isset($qparam['user_type']) && !empty($qparam['user_type']) ) { |
| 50 | + $query->condition('field_account_type.entity.tid', $qparam['user_type']); |
| 51 | + } |
| 52 | + $users = $query->execute(); |
| 53 | +}; |
| 54 | +function () { |
| 55 | + $query = \Drupal::entityQuery('user') |
| 56 | + ->condition('status', 1) |
| 57 | + ->condition('uid', 1, '<>') |
| 58 | + ->condition('field_profile_visibility', 1) |
| 59 | + ->condition('field_account_type', '', '<>') |
| 60 | + ->condition('field_last_name.value', '', '<>'); |
| 61 | + if( isset($qparam['expertise']) && !empty($qparam['expertise']) ) { |
| 62 | + $query->condition('field_field_expertise.entity.tid', $qparam['expertise']); |
| 63 | + } |
| 64 | + if( isset($qparam['origin']) && !empty($qparam['origin']) ) { |
| 65 | + $query->condition('field_place_origin.entity:taxonomy_term.field_country_tags', $qparam['origin']); |
| 66 | + } |
| 67 | + if( isset($qparam['place_residence']) && !empty($qparam['place_residence']) ) { |
| 68 | + $query->condition('field_place_residence.entity:taxonomy_term.field_country_tags', $qparam['place_residence']); |
| 69 | + } |
| 70 | + if( isset($qparam['city']) && !empty($qparam['city']) ) { |
| 71 | + $query->condition('field_city', $qparam['city'], 'CONTAINS'); |
| 72 | + } |
| 73 | + if( isset($qparam['user_type']) && !empty($qparam['user_type']) ) { |
| 74 | + $query->condition('field_account_type.entity.tid', $qparam['user_type']); |
| 75 | + } |
| 76 | + $query->accessCheck(FALSE); |
| 77 | + $users = $query->execute(); |
| 78 | +}; |
0 commit comments