--- og_user_roles.module.5.x-3.1.orig	2008-05-11 11:41:52.000000000 -0700
+++ og_user_roles.module	2008-05-11 19:08:17.000000000 -0700
@@ -1,5 +1,5 @@
 <?php
-// $Id: og_user_roles.module,v 1.1.2.14 2008/05/11 04:27:55 somebodysysop Exp $
+// $Id: og_user_roles.module,v 1.1.2.3 2007/07/08 19:50:44 somebodysysop Exp $
 
 /**
  * @file
@@ -2733,6 +2733,7 @@ function og_user_roles_form_alter($form_
       '#description' => t('If you received a group registration code, enter it here.'),
     );
   }
+  $roles = array();
   // If this is a group node edit (use og_last to determine if this is a group node) and
   // the user has the 'configure member roles' permission, and we allow group admins
   // to set default group roles, then print the 'basicgrouprole' form on the
@@ -2863,19 +2864,22 @@ function og_user_roles_form_alter($form_
               <p><strong>Code1,Code2,Code3<br /></strong></p>
               <p>Each registration code separated by a comma. No spaces.'),
             );
-          $form['og_user_roles_regcode_gid']['og_user_roles_assign_regcoderole_' . $gid] = array(
-            '#type' => 'checkbox',
-            '#title' => t('Set default basic group (group limited) role for users who join this group using this registration code?'),
-            '#default_value' => variable_get('og_user_roles_assign_regcoderole_' . $gid, 0),
-            '#description' => t('Do you wish to automatically assign a specific "registration code group role" to new subscribers to this group <b>who use this registration code to subscribe</b> to this group? The role is limited to this group. This role assignment can be be removed by the groups\' admin(s)'),
-            );
-          $form['og_user_roles_regcode_gid']['og_user_roles_regcoderole_value_' . $gid] = array(
-            '#type' => 'select',
-            '#title' => t('Role to assign'),
-            '#options' => $roles,
-            '#default_value' => variable_get('og_user_roles_regcoderole_value_' . $gid, 0),
-            '#description' => t('Select the role you wish to use as the "registration code group role" for every new subscriber who subscribes to this group using one of the registration codes above.'),
-            );      
+      	  // They only see this if they can configure user roles
+          if (user_access('configure member roles')) {
+            $form['og_user_roles_regcode_gid']['og_user_roles_assign_regcoderole_' . $gid] = array(
+              '#type' => 'checkbox',
+              '#title' => t('Set default basic group (group limited) role for users who join this group using this registration code?'),
+              '#default_value' => variable_get('og_user_roles_assign_regcoderole_' . $gid, 0),
+              '#description' => t('Do you wish to automatically assign a specific "registration code group role" to new subscribers to this group <b>who use this registration code to subscribe</b> to this group? The role is limited to this group. This role assignment can be be removed by the groups\' admin(s)'),
+              );
+            $form['og_user_roles_regcode_gid']['og_user_roles_regcoderole_value_' . $gid] = array(
+              '#type' => 'select',
+              '#title' => t('Role to assign'),
+              '#options' => $roles,
+              '#default_value' => variable_get('og_user_roles_regcoderole_value_' . $gid, 0),
+              '#description' => t('Select the role you wish to use as the "registration code group role" for every new subscriber who subscribes to this group using one of the registration codes above.'),
+              );      
+          }
           $form['#validate'] += array('og_user_roles_regcode_form_validate' => array($form_id, &$form));          
           $form['#submit'] += array('og_user_roles_regcode_form_submit' => array($form_id, &$form));          
         }
