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	12 Mar 2009 16:20:26 -0000
@@ -377,3 +377,23 @@
   // 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 all domains
+ * @return array
+ */
+function domain_user_default_get_default_user_count($domain_id = 'all') {
+  if ($domain_id == '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'];
+    }
+  }
+  else {
+    $count = db_result(db_query("SELECT count(uid) FROM {domain_user_default} WHERE domain_id = %d", $domain_id));
+    $user_count[$domain_id] = $count;
+  }
+  return $user_count;
+}
+

