Created
October 19, 2011 12:39
-
-
Save chrisns/1298181 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff U subuser.module subuser.module | |
--- subuser.module Mon Jan 19 22:26:36 1970 | |
+++ subuser.module Mon Jan 19 22:26:36 1970 | |
@@ -366 +366 @@ | |
- $links[] = l(t(SUBUSER_ADMINISTER), 'admin/user/user'); | |
+ // $links[] = l(t(SUBUSER_ADMINISTER), 'admin/user/user'); | |
diff U subuser.pages.inc subuser.pages.inc | |
--- subuser.pages.inc Mon Jan 19 22:26:36 1970 | |
+++ subuser.pages.inc Mon Jan 19 22:26:36 1970 | |
@@ -186,0 +187,5 @@ | |
+ // Get all non-default roles. | |
+ $roles = user_roles(TRUE); | |
+ unset($roles[DRUPAL_ANONYMOUS_RID]); | |
+ unset($roles[DRUPAL_AUTHENTICATED_RID]); | |
+ | |
@@ -232,0 +238,27 @@ | |
+ | |
+ if ($roles) { | |
+ | |
+ $available_roles = variable_get('subuser_roles', array()); | |
+ | |
+ foreach ($roles as $role_id => $role_name) { | |
+ if (empty($available_roles[$role_id])) { | |
+ unset($roles[$role_id]); | |
+ } | |
+ } | |
+ | |
+ $form['roles'] = array( | |
+ '#type' => 'fieldset', | |
+ '#title' => t('Roles'), | |
+ '#description' => t('Choose the roles you would like for sub users to automatically have when created.') | |
+ ); | |
+ $form['roles']['roles'] = array( | |
+ '#type' => 'checkboxes', | |
+ '#title' => t('Available roles'), | |
+ '#options' => $roles, | |
+ '#default_value' => variable_get('subuser_roles', array()), | |
+ ); | |
+ } | |
+ else { | |
+ drupal_set_message(t('No available roles to select. Please <a href="@admin-role">create a role</a>.', array('@admin-role' => url("admin/user/roles"))), 'error'); | |
+ } | |
+ | |
@@ -237,4 +269,4 @@ | |
- $form['roles'] = array( | |
- '#type' => 'value', | |
- '#value' => variable_get('subuser_roles', array()) | |
- ); | |
+// $form['roles'] = array( | |
+// '#type' => 'value', | |
+// '#value' => variable_get('subuser_roles', array()) | |
+// ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment