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/lib | |
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/lib')
-rw-r--r-- | mod/uservalidationbyemail/lib/functions.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/mod/uservalidationbyemail/lib/functions.php b/mod/uservalidationbyemail/lib/functions.php index ed66b40d4..0610c1809 100644 --- a/mod/uservalidationbyemail/lib/functions.php +++ b/mod/uservalidationbyemail/lib/functions.php @@ -104,4 +104,45 @@ function uservalidationbyemail_set_user_validation_status($user_guid, $status, $ } return FALSE; +} + +/** + * Returns the validation status of a user. + * + * @param unknown_type $user_guid + * @return int|null + */ +function uservalidationbyemail_get_user_validation_status($user_guid) { + return get_metadata_byname($user_guid, 'validated'); +} + +/** + * Returns all users who haven't been validated. + * + * "Unvalidated" means metadata of validated is not set or not truthy. + * We can't use the elgg_get_entities_from_metadata() because you can't say + * "where the entity has metadata set OR it's not equal to 1". + * + * This doesn't include any security, so should be called ONLY be admin users! + * @return array + */ +function uservalidationbyemail_get_unvalidated_users() { + global $CONFIG; + + $validated_id = get_metastring_id('validated'); + $one_id = get_metastring_id(1); + + // thanks to daveb@freenode for the SQL tips! + $q = "SELECT e.* FROM {$CONFIG->dbprefix}entities e + WHERE e.type = 'user' + AND NOT EXISTS ( + SELECT 1 FROM {$CONFIG->dbprefix}metadata md + WHERE md.entity_guid = e.guid + AND md.name_id = $validated_id + AND md.value_id = $one_id) + + ORDER BY e.guid DESC"; + + $users = get_data($q, 'entity_row_to_elggstar'); + return $users; }
\ No newline at end of file |