aboutsummaryrefslogtreecommitdiff
path: root/mod/uservalidationbyemail/views/default/admin/users/unvalidated.php
blob: 332fac3f9c10e66a9ade1863c56e3c984fa95c04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
/**
 * Admin area to view, validate, resend validation email, or delete unvalidated users.
 *
 * @package Elgg.Core.Plugin
 * @subpackage UserValidationByEmail.Administration
 */

$limit = get_input('limit', 10);
$offset = get_input('offset', 0);

// can't use elgg_list_entities() and friends because we don't use the default view for users.
$ia = elgg_set_ignore_access(TRUE);
$hidden_entities = access_get_show_hidden_status();
access_show_hidden_entities(TRUE);

$options = array(
	'type' => 'user',
	'metadata_name' => 'validated',
	'metadata_value' => 0,
	'limit' => $limit,
	'offset' => $offset
);
$users = elgg_get_entities_from_metadata($options);

$options['count'] = TRUE;
$count = elgg_get_entities_from_metadata($options);

access_show_hidden_entities($hidden_entities);
elgg_set_ignore_access($ia);

// setup pagination
$pagination = elgg_view('navigation/pagination', array(
	'baseurl' => $vars['url'] . 'pg/admin/users/unvalidated',
	'offset' => $offset,
	'count' => $count,
	'limit' => $limit,
));

echo $pagination;

if ($users) {
	foreach ($users as $user) {
		$form_body .= elgg_view('uservalidationbyemail/unvalidated_user', array('theuser' => $user));
	}
} else {
	echo elgg_echo('uservalidationbyemail:admin:no_unvalidated_users');
	return;
}

$form_body .= elgg_echo('uservalidationbyemail:admin:with_checked') . elgg_view('input/pulldown', array(
	'internalname' => 'action_type',
	'options_values' => array(
		'validate' => elgg_echo('uservalidationbyemail:admin:validate'),
		'resend_validation' => elgg_echo('uservalidationbyemail:admin:resend_validation'),
		'delete' => elgg_echo('uservalidationbyemail:admin:delete'),
	),
	'value' => 'resend_validation',
));

$form_body .= '<br />' . elgg_view('input/submit', array('value' => elgg_echo('submit')));

echo elgg_view('input/form', array(
	'action' => 'action/uservalidationbyemail/bulk_action',
	'body' => $form_body
));