--- og_promote.module.ori	2008-08-21 11:16:21.000000000 -0300
+++ og_promote.module	2008-08-21 11:17:01.000000000 -0300
@@ -91,29 +91,7 @@ function og_promote_admin_settings() {
   else {
     $form['og_promote_role'] = array('#type' => 'item', '#title' => t('No roles'), '#description' => t('You need to define some additional roles to use this module.'));
   }
-  $options = array();
-  $values = array();
-  $types = variable_get('og_node_types', array('og'));
-  foreach ($types as $type) {
-    $result = db_query("SELECT n.nid, n.title, o.* FROM {node} n INNER JOIN {og} o ON n.nid = o.nid WHERE n.type = '%s' ORDER BY n.title", $type);
-    while ($group = db_fetch_object($result)) {
-      $options[$group->nid] = check_plain($group->title);
-      switch ($group->selective) {
-        case OG_OPEN:
-          $options[$group->nid] .= check_plain($row->title) .' '. t('(open group)');
-          break;
-        case OG_MODERATED:
-          $options[$group->nid] .= check_plain($row->title) .' '. t('(moderated group)');
-          break;
-        case OG_INVITE_ONLY:
-          $options[$group->nid] .= check_plain($row->title) .' '. t('(invite only group)');
-          break;
-        case OG_CLOSED:
-          $options[$group->nid] .= check_plain($row->title) .' '. t('(closed group)');
-          break;
-      }
-    }
-  }
+  $options = og_all_groups_options();
   if (count($options)) {
     $form['og_promote_groups'] = array('#type' => 'checkboxes', '#title' => t('Groups'), '#options' => $options, '#default_value' => variable_get('og_promote_groups', array()), '#description' => t('The groups that are defined for this site.'));
   }
