? 490846-user-enable.patch
? domain_views/485762-views.patch
Index: domain.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/domain/domain.module,v
retrieving revision 1.109
diff -u -p -r1.109 domain.module
--- domain.module	8 Jun 2009 17:31:13 -0000	1.109
+++ domain.module	13 Jun 2009 18:42:26 -0000
@@ -1195,15 +1195,16 @@ function domain_set_default_grant() {
 
 /**
  * Upon enabling this module, store the default view grant
- * in the {node_access} table.
+ * in the {node_access} table. Then it assigns all users to
+ * the primary domain.
  */
 function domain_enable() {
   // Set the default 'domain_all' grant for special pages.
   domain_set_default_grant();
   // Thanks to the new way that batch processing of node grants is handled, we have to
   // manually define our records if none are present.
-  $count = db_result(db_query("SELECT COUNT(*) FROM {domain_access}"));
-  if ($count == 0) {
+  $count = (bool) db_result(db_query("SELECT COUNT(*) FROM {domain_access}"));
+  if (empty($count)) {
     $rule = variable_get('domain_behavior', DOMAIN_INSTALL_RULE);
     $site = DOMAIN_SITE_GRANT;
     $nids = db_query("SELECT nid FROM {node}");
@@ -1217,6 +1218,14 @@ function domain_enable() {
       }
     }
   }
+  // Add users to the {domain_editor} table, but skip user 0.
+  $result = db_query("SELECT uid FROM {users} WHERE uid > 0");
+  while ($data = db_fetch_object($result)) {
+    $check = (bool) db_result(db_query("SELECT COUNT(*) FROM {domain_editor} WHERE uid = %d", $data->uid));
+    if (empty($check)) {
+      db_query("INSERT INTO {domain_editor} VALUES (%d, %d)", $data->uid, 0);
+    }
+  }
 }
 
 /**
