]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Using more built-in API to get unvalidated users.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 5 Oct 2010 03:09:08 +0000 (03:09 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 5 Oct 2010 03:09:08 +0000 (03:09 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7009 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/uservalidationbyemail/lib/functions.php
mod/uservalidationbyemail/views/default/admin/users/unvalidated.php

index 0610c18098f576028717651837204ec19b0600f3..4ba5d13b794bf7053376871e7b0162d6e6b7385e 100644 (file)
@@ -126,23 +126,18 @@ function uservalidationbyemail_get_user_validation_status($user_guid) {
  * This doesn't include any security, so should be called ONLY be admin users!
  * @return array
  */
-function uservalidationbyemail_get_unvalidated_users() {
+function uservalidationbyemail_get_unvalidated_users_sql_where() {
        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 (
+       $where = "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)
+                               AND md.value_id = $one_id)";
 
-               ORDER BY e.guid DESC";
-
-       $users = get_data($q, 'entity_row_to_elggstar');
-       return $users;
+       return $where;
 }
\ No newline at end of file
index 4a14482df197d2810895b3ab6a9f27c08d442457..bfd4a8d2e0746046a20ec862202cb5d2ff4dea90 100644 (file)
@@ -7,7 +7,12 @@
  */
 
 // @todo pagination would be nice.
-$users = uservalidationbyemail_get_unvalidated_users();
+// can't use elgg_list_entities() and friends because we don't use the default view for users.
+$users = elgg_get_entities(array(
+       'type' => 'user',
+       'wheres' => array(uservalidationbyemail_get_unvalidated_users_sql_where()),
+       'limit' => 9999,
+));
 
 if ($users) {
        foreach ($users as $user) {