resend_validation.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * Resends validation emails to a user or users by guid
  4. *
  5. * @package Elgg.Core.Plugin
  6. * @subpackage UserValidationByEmail
  7. */
  8. $user_guids = get_input('user_guids');
  9. $error = FALSE;
  10. if (!$user_guids) {
  11. register_error(elgg_echo('uservalidationbyemail:errors:unknown_users'));
  12. forward(REFERRER);
  13. }
  14. $access = access_get_show_hidden_status();
  15. access_show_hidden_entities(TRUE);
  16. foreach ($user_guids as $guid) {
  17. $user = get_entity($guid);
  18. if (!$user instanceof ElggUser) {
  19. $error = TRUE;
  20. continue;
  21. }
  22. // don't resend emails to validated users
  23. $is_validated = elgg_get_user_validation_status($guid);
  24. if ($is_validated !== FALSE || !uservalidationbyemail_request_validation($guid)) {
  25. $error = TRUE;
  26. continue;
  27. }
  28. }
  29. access_show_hidden_entities($access);
  30. if (count($user_guids) == 1) {
  31. $message_txt = elgg_echo('uservalidationbyemail:messages:resent_validation');
  32. $error_txt = elgg_echo('uservalidationbyemail:errors:could_not_resend_validation');
  33. } else {
  34. $message_txt = elgg_echo('uservalidationbyemail:messages:resent_validations');
  35. $error_txt = elgg_echo('uservalidationbyemail:errors:could_not_resend_validations');
  36. }
  37. if ($error) {
  38. register_error($error_txt);
  39. } else {
  40. system_message($message_txt);
  41. }
  42. forward(REFERRER);