--- og_subgroups.module.orig	2008-06-05 10:47:25.000000000 -0700
+++ og_subgroups.module	2008-08-29 18:30:39.000000000 -0700
@@ -52,6 +52,12 @@ function og_subgroups_menu($may_cache) {
  * Menu callback; displays the subgroups configuration page.
  */
 function og_subgroups_settings() {
+  $form['og_subgroups_admin'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Admin status'),
+    '#description' => t('Click here if you only want users to be able to select groups in which they are administrators.'),
+    '#default_value' => variable_get('og_subgroups_admin', 0),
+  );
   $form['propagte_content'] = array(
     '#type' => 'fieldset',
     '#title' => t('Group posts propagation'),
@@ -261,6 +267,7 @@ function og_subgroups_get_family($gid, $
  *   The operation
  */
 function og_subgroups_get_eligable_groups($op) {
+  global $user;
   $eligable_groups = og_node_groups_distinguish(og_all_groups_options(), FALSE);
   $return = array();
   switch ($op) {
@@ -274,7 +281,16 @@ function og_subgroups_get_eligable_group
       // Get excluded groups.
       foreach ($eligable_groups['inaccessible'] as $group) {
         $return[$group] = $group;
-      } 
+      }
+      break; 
+    case 'admin':  
+      // Get all accessible groups for this user in which he is admin.
+      foreach ($eligable_groups['accessible'] as $key => $group) {
+        if (db_result(db_query("SELECT COUNT(uid) FROM {og_uid} WHERE nid = %d AND uid = %d AND is_admin = 1", $key, $user->uid))) {
+          $return[$key] = $group['title'];
+	    }
+      }
+     break; 
   }
   return $return;
 }
@@ -287,7 +303,11 @@ function og_subgroups_outline($nid) {
   $node = node_load($nid);
   
   // Get all accessible/ inaccesiable groups for the user.
-  $options = og_subgroups_get_eligable_groups('accessibale');
+  if (variable_get('og_subgroups_admin', 0) == 1) {
+    $options = og_subgroups_get_eligable_groups('admin');
+  } else {
+    $options = og_subgroups_get_eligable_groups('accessibale');
+  }
   $inaccessibale = og_subgroups_get_eligable_groups('inaccessibale');
   
   $description = t('The parent group for this group node in the subgroups.');
