Elgg  Version 4.3
UserUnvalidated.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Menus;
4 
6 
14 
22  public static function register(\Elgg\Hook $hook) {
23  if (!elgg_is_admin_logged_in()) {
24  return;
25  }
26 
27  $entity = $hook->getEntityParam();
28  if (!$entity instanceof \ElggUser || $entity->isValidated()) {
29  return;
30  }
31 
32  /* @var $return MenuItems */
33  $return = $hook->getValue();
34 
35  $return[] = \ElggMenuItem::factory([
36  'name' => 'change_email',
37  'icon' => 'edit',
38  'text' => elgg_echo('admin:users:unvalidated:change_email'),
39  'href' => elgg_http_add_url_query_elements('ajax/form/admin/user/change_email', [
40  'user_guid' => $entity->guid,
41  ]),
42  'link_class' => 'elgg-lightbox',
43  'priority' => 100,
44  ]);
45 
46  $return[] = \ElggMenuItem::factory([
47  'name' => 'validate',
48  'icon' => 'check',
49  'text' => elgg_echo('validate'),
50  'href' => elgg_generate_action_url('admin/user/validate', [
51  'user_guid' => $entity->guid,
52  ]),
53  'confirm' => true,
54  'priority' => 400,
55  ]);
56 
57  $return[] = \ElggMenuItem::factory([
58  'name' => 'delete',
59  'icon' => 'delete',
60  'text' => elgg_echo('delete'),
61  'title' => elgg_echo('delete'),
62  'href' => elgg_generate_action_url('admin/user/delete', [
63  'guid' => $entity->guid,
64  ]),
65  'confirm' => elgg_echo('deleteconfirm'),
66  'priority' => 500,
67  ]);
68 
69  return $return;
70  }
71 }
elgg_http_add_url_query_elements($url, array $elements)
Sets elements in a URL&#39;s query string.
Definition: elgglib.php:481
elgg_is_admin_logged_in()
Returns whether or not the viewer is currently logged in and an admin user.
Definition: sessions.php:52
elgg_generate_action_url($action, array $query=[], $add_csrf_tokens=true)
Generate an action URL.
elgg_echo($message_key, array $args=[], $language="")
Elgg language module Functions to manage language and translations.
Definition: languages.php:18
static factory($options)
Create an ElggMenuItem from an associative array.
Models an event passed to hook handlers.
Definition: Hook.php:11
$entity
Definition: reset.php:8
Register menu items to the user:unvalidated menu.