Elgg  Version master
users.php
Go to the documentation of this file.
1 <?php
2 
4 
6 
7 $limit = (int) elgg_extract('limit', $vars, elgg_get_config('default_limit'));
10 
12  'query' => $query,
13  'type' => 'user',
14  'limit' => $limit,
15  'sort_by' => [
16  'property_type' => 'metadata',
17  'property' => 'name',
18  'direction' => 'ASC',
19  ],
20  'fields' => ['metadata' => ['name', 'username']],
21  'item_view' => elgg_extract('item_view', $vars, 'search/entity'),
22  'input_name' => $input_name,
23 ];
24 
25 if (elgg_extract('friends_only', $vars, false)) {
26  $target_guid = (int) elgg_extract('match_target', $vars);
27  if ($target_guid) {
29  } else {
31  }
32 
33  if (!$target || !$target->canEdit()) {
34  throw new EntityPermissionsException();
35  }
36 
37  $options['relationship'] = 'friend';
38  $options['relationship_guid'] = $target->guid;
39 }
40 
41 // by default search in all users,
42 // with 'include_banned' => false, only search in 'allowed' users
43 if (!(bool) elgg_extract('include_banned', $vars, true)) {
44  $options['metadata_name_value_pairs'][] = [
45  'name' => 'banned',
46  'value' => 'no',
47  ];
48 }
49 
50 $body = elgg_list_entities($options, 'elgg_search');
51 
52 echo elgg_view_page('', $body);
if(!$comment instanceof\ElggComment||!$comment->canEdit()) $target
Definition: edit.php:13
elgg_get_config(string $name, $default=null)
Get an Elgg configuration value.
$limit
Definition: users.php:7
$target_guid
Definition: groups.php:25
$options
Definition: users.php:11
canEdit(int $user_guid=0)
Can a user edit this entity?
Definition: ElggEntity.php:946
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
get_entity(int $guid)
Loads and returns an entity object from a guid.
Definition: entities.php:67
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:256
if(elgg_extract('friends_only', $vars, false)) if(!(bool) elgg_extract('include_banned', $vars, true)) $body
Definition: users.php:50
$query
Definition: users.php:8
elgg_list_entities(array $options=[], callable $getter=null, callable $viewer=null)
Returns a string of rendered entities.
Definition: entities.php:548
elgg_gatekeeper()
Used at the top of a page to mark it as logged in users only.
Definition: gatekeepers.php:64
$vars['head']
Definition: html.php:24
elgg_get_logged_in_user_entity()
Return the current logged in user, or null if no user is logged in.
Definition: sessions.php:24
$input_name
Definition: users.php:9