Index: domain_user_default.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/domain_user_default/domain_user_default.module,v retrieving revision 1.1.2.11 diff -u -r1.1.2.11 domain_user_default.module --- domain_user_default.module 20 Oct 2008 16:18:10 -0000 1.1.2.11 +++ domain_user_default.module 11 Mar 2009 22:02:58 -0000 @@ -377,3 +377,25 @@ // behavior set to 1 indicates a redirect only on matches return $matches xor $behavior; } + +/** + * Retrive the number of users that have given domain marked as their default. + * If no domain id is given return user count for the default domain. + * @return int + */ +function domain_user_default_get_user_count($domain_id = -1) { + $user_count = db_result(db_query("SELECT count(uid) FROM {domain_user_default} WHERE domain_id = %d", $domain_id)); + return $user_count; +} + +/** + * Retrive the number of users that have a default domain for each domain. + * @return array + */ +function domain_user_default_get_user_count_all() { + $result= db_query("SELECT domain_id, count(uid) as count FROM {domain_user_default} GROUP BY domain_id"); + while ($data = db_fetch_array($result)) { + $user_count[$data['domain_id']] = $data['count']; + } + return $user_count; +}