diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-10-01 21:01:39 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-10-01 21:01:39 +0000 |
commit | b04f30ecf2347104131b8dccf7bb349b5ec72762 (patch) | |
tree | e01ce61019547a4e8ccfcd66ea6cbf9247b15639 /mod/uservalidationbyemail/actions | |
parent | b38d8fc9291ae3c9c6d64b2d950fb0b309699f22 (diff) | |
download | elgg-b04f30ecf2347104131b8dccf7bb349b5ec72762.tar.gz elgg-b04f30ecf2347104131b8dccf7bb349b5ec72762.tar.bz2 |
Added admin page to validate, resend validation requests, or delete unvalidated users.
git-svn-id: http://code.elgg.org/elgg/trunk@6997 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/uservalidationbyemail/actions')
-rw-r--r-- | mod/uservalidationbyemail/actions/bulk_action.php | 18 | ||||
-rw-r--r-- | mod/uservalidationbyemail/actions/delete.php | 52 | ||||
-rw-r--r-- | mod/uservalidationbyemail/actions/resend_validation.php | 52 | ||||
-rw-r--r-- | mod/uservalidationbyemail/actions/validate.php | 53 |
4 files changed, 175 insertions, 0 deletions
diff --git a/mod/uservalidationbyemail/actions/bulk_action.php b/mod/uservalidationbyemail/actions/bulk_action.php new file mode 100644 index 000000000..fbbcc1c93 --- /dev/null +++ b/mod/uservalidationbyemail/actions/bulk_action.php @@ -0,0 +1,18 @@ +<?php +/** + * Dispatches a bulk action to real action. + * + * @package Elgg.Core.Plugin + * @subpackage UserValidationByEmail + */ + +$action_type = get_input('action_type'); +$valid_actions = array('delete', 'resend_validation', 'validate'); + +if (!in_array($action_type, $valid_actions)) { + forward(REFERRER); +} + +$action_name = "uservalidationbyemail/$action_type"; + +action($action_name);
\ No newline at end of file diff --git a/mod/uservalidationbyemail/actions/delete.php b/mod/uservalidationbyemail/actions/delete.php new file mode 100644 index 000000000..14d40e89c --- /dev/null +++ b/mod/uservalidationbyemail/actions/delete.php @@ -0,0 +1,52 @@ +<?php +/** + * Delete a user or users by guid + * + * @package Elgg.Core.Plugin + * @subpackage UserValidationByEmail + */ + +$user_guids = get_input('user_guids'); +$error = FALSE; + +if (!$user_guids) { + register_error(elgg_echo('uservalidationbyemail:errors:unknown_users')); + forward(REFERRER); +} + +$access = access_get_show_hidden_status(); +access_show_hidden_entities(TRUE); + +foreach ($user_guids as $guid) { + $user = get_entity($guid); + if (!$user instanceof ElggUser) { + $error = TRUE; + continue; + } + + // don't delete validated users + $is_validated = uservalidationbyemail_get_user_validation_status($guid); + + if ($is_validated || !$user->delete()) { + $error = TRUE; + continue; + } +} + +access_show_hidden_entities($access); + +if (count($user_guids) == 1) { + $message_txt = elgg_echo('uservalidationbyemail:messages:deleted_user'); + $error_txt = elgg_echo('uservalidationbyemail:errors:could_not_delete_user'); +} else { + $message_txt = elgg_echo('uservalidationbyemail:messages:deleted_users'); + $error_txt = elgg_echo('uservalidationbyemail:errors:could_not_delete_users'); +} + +if ($error) { + register_error($error_txt); +} else { + system_message($message_txt); +} + +forward(REFERRER);
\ No newline at end of file diff --git a/mod/uservalidationbyemail/actions/resend_validation.php b/mod/uservalidationbyemail/actions/resend_validation.php new file mode 100644 index 000000000..70c2244b9 --- /dev/null +++ b/mod/uservalidationbyemail/actions/resend_validation.php @@ -0,0 +1,52 @@ +<?php +/** + * Resends validation emails to a user or users by guid + * + * @package Elgg.Core.Plugin + * @subpackage UserValidationByEmail + */ + +$user_guids = get_input('user_guids'); +$error = FALSE; + +if (!$user_guids) { + register_error(elgg_echo('uservalidationbyemail:errors:unknown_users')); + forward(REFERRER); +} + +$access = access_get_show_hidden_status(); +access_show_hidden_entities(TRUE); + +foreach ($user_guids as $guid) { + $user = get_entity($guid); + if (!$user instanceof ElggUser) { + $error = TRUE; + continue; + } + + // don't resend emails to validated users + $is_validated = uservalidationbyemail_get_user_validation_status($guid); + + if ($is_validated || !uservalidationbyemail_request_validation($guid)) { + $error = TRUE; + continue; + } +} + +access_show_hidden_entities($access); + +if (count($user_guids) == 1) { + $message_txt = elgg_echo('uservalidationbyemail:messages:resent_validation'); + $error_txt = elgg_echo('uservalidationbyemail:errors:could_not_resend_validation'); +} else { + $message_txt = elgg_echo('uservalidationbyemail:messages:resent_validations'); + $error_txt = elgg_echo('uservalidationbyemail:errors:could_not_resend_validations'); +} + +if ($error) { + register_error($error_txt); +} else { + system_message($message_txt); +} + +forward(REFERRER);
\ No newline at end of file diff --git a/mod/uservalidationbyemail/actions/validate.php b/mod/uservalidationbyemail/actions/validate.php new file mode 100644 index 000000000..c50053dce --- /dev/null +++ b/mod/uservalidationbyemail/actions/validate.php @@ -0,0 +1,53 @@ +<?php +/** + * Validate a user or users by guid + * + * @package Elgg.Core.Plugin + * @subpackage UserValidationByEmail + */ + +$user_guids = get_input('user_guids'); +$error = FALSE; + +if (!$user_guids) { + register_error(elgg_echo('uservalidationbyemail:errors:unknown_users')); + forward(REFERRER); +} + +$access = access_get_show_hidden_status(); +access_show_hidden_entities(TRUE); + +foreach ($user_guids as $guid) { + $user = get_entity($guid); + if (!$user instanceof ElggUser) { + $error = TRUE; + continue; + } + + // only validate if not validated + $is_validated = uservalidationbyemail_get_user_validation_status($guid); + $validate_success = uservalidationbyemail_set_user_validation_status($guid, TRUE); + + if (!$is_validated || !$validate_success || !$user->enable()) { + $error = TRUE; + continue; + } +} + +access_show_hidden_entities($access); + +if (count($user_guids) == 1) { + $message_txt = elgg_echo('uservalidationbyemail:messages:validated_user'); + $error_txt = elgg_echo('uservalidationbyemail:errors:could_not_validate_user'); +} else { + $message_txt = elgg_echo('uservalidationbyemail:messages:validated_users'); + $error_txt = elgg_echo('uservalidationbyemail:errors:could_not_validate_users'); +} + +if ($error) { + register_error($error_txt); +} else { + system_message($message_txt); +} + +forward(REFERRER);
\ No newline at end of file |