Elgg  Version master
users.php
Go to the documentation of this file.
1 <?php
2 
4 
6 
8  'query' => elgg_extract('term', $vars),
9  'type' => 'user',
10  'limit' => elgg_extract('limit', $vars),
11  'sort_by' => [
12  'property_type' => 'metadata',
13  'property' => 'name',
14  'direction' => 'ASC',
15  ],
16  'fields' => ['metadata' => ['name', 'username']],
17  'item_view' => elgg_extract('item_view', $vars, 'search/entity'),
18  'input_name' => elgg_extract('name', $vars),
19 ];
20 
21 if (elgg_extract('friends_only', $vars, false)) {
22  $target_guid = (int) elgg_extract('match_target', $vars);
23  if ($target_guid) {
25  } else {
27  }
28 
29  if (!$target || !$target->canEdit()) {
30  throw new EntityPermissionsException();
31  }
32 
33  $options['relationship'] = 'friend';
34  $options['relationship_guid'] = $target->guid;
35 }
36 
37 // by default search in all users,
38 // with 'include_banned' => false, only search in 'allowed' users
39 if (!(bool) elgg_extract('include_banned', $vars, true)) {
40  $options['metadata_name_value_pairs'][] = [
41  'name' => 'banned',
42  'value' => 'no',
43  ];
44 }
45 
46 $body = elgg_list_entities($options, 'elgg_search');
47 
48 echo elgg_view_page('', $body);
$target_guid
Definition: groups.php:21
$options
Definition: users.php:7
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:254
$target
Definition: create.php:17
get_entity(int $guid)
Loads and returns an entity object from a guid.
Definition: entities.php:70
Thrown when entity can not be edited or container permissions do not allow it to be written...
elgg_view_page(string $title, string|array $body, string $page_shell= 'default', array $vars=[])
Assembles and outputs a full page.
Definition: views.php:235
if(elgg_extract('friends_only', $vars, false)) if(!(bool) elgg_extract('include_banned', $vars, true)) $body
Definition: users.php:46
elgg_list_entities(array $options=[], callable $getter=null, callable $viewer=null)
Returns a string of rendered entities.
Definition: entities.php:551
$vars
Definition: theme.php:5
elgg_gatekeeper()
Used at the top of a page to mark it as logged in users only.
Definition: gatekeepers.php:64
elgg_get_logged_in_user_entity()
Return the current logged in user, or null if no user is logged in.
Definition: sessions.php:24