Elgg  Version 6.0
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\Event $event) {
23  if (!elgg_is_admin_logged_in()) {
24  return;
25  }
26 
27  $entity = $event->getEntityParam();
28  if (!$entity instanceof \ElggUser || $entity->isValidated()) {
29  return;
30  }
31 
32  /* @var $return MenuItems */
33  $return = $event->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_generate_action_url(string $action, array $query=[], bool $add_csrf_tokens=true)
Generate an action URL.
elgg_is_admin_logged_in()
Returns whether or not the viewer is currently logged in and an admin user.
Definition: sessions.php:52
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
static factory(array $options)
Create an ElggMenuItem from an associative array.
$entity
Definition: reset.php:8
elgg_http_add_url_query_elements(string $url, array $elements)
Sets elements in a URL&#39;s query string.
Definition: elgglib.php:181
Register menu items to the user:unvalidated menu.
Models an event passed to event handlers.
Definition: Event.php:11