Index: rolesignup.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/rolesignup/rolesignup.module,v
retrieving revision 1.3
diff -u -p -r1.3 rolesignup.module
--- rolesignup.module 20 Jan 2007 21:45:13 -0000 1.3
+++ rolesignup.module 25 Oct 2007 03:27:30 -0000
@@ -14,6 +14,17 @@ function rolesignup_menu($may_cache) {
'title' => t('Register'),
'type' => MENU_LOCAL_TASK);
+ if ($may_cache) {
+ $items[] = array(
+ 'path' => 'admin/settings/rolesignup',
+ 'title' => t('Role Signup'),
+ 'description' => t('Add descriptions to the user roles, for display on the role select page.'),
+ 'callback' => 'drupal_get_form',
+ 'callback arguments' => array('rolesignup_admin_settings'),
+ 'access' => user_access('administer site configuration'),
+ 'type' => MENU_LOCAL_TASK,
+ );
+ }
return $items;
}
@@ -70,11 +81,15 @@ function rolesignup_user($op, &$edit, &$
/* Theme functions */
function theme_rolelist($roles) {
- $output = t("
Please select what type of account you would like
");
+ $output = t("Please select what type of account you would like:
");
$output .= "\n";
foreach ($roles as $roleid => $role) {
$url = "user/register/role/".$roleid;
- $output .= "- ".l($role, $url)."
\n";
+ if (variable_get($role .'-description', '') != '') {
+ $roledescription = "
". variable_get($role .'-description', '') ."";
+ }
+ $role = ucfirst($role);
+ $output .= "- ". l($role, $url) . $roledescription ."
\n";
}
$output .= "
\n";
return $output;
@@ -90,3 +105,32 @@ function theme_select_role() {
return $output;
}
+/**
+ * Implementation of hook_admin_settings()
+ */
+function rolesignup_admin_settings() {
+ $roles = user_roles();
+ drupal_set_title(t('Role descriptions'));
+ $form['rolesignup-intro'] = array(
+ '#value' => t('You may enter a description for each of the available roles. The description will be displayed on the role selection page. You can leave the description blank if you want to.'),
+ );
+
+ foreach ($roles as $roleid => $role) {
+ $form['rolesignup'. $role .'-fs'] = array(
+ '#type' => 'fieldset',
+ '#title' => $role,
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ );
+ $form['rolesignup'. $role .'-fs'][$role .'-description'] = array(
+ '#type' => 'textarea',
+ '#title' => t('Enter description for the %rolename role', array('%rolename' => $role)),
+ '#attributes' => array(
+ 'class' => 'role-description',
+ ),
+ '#default_value' => variable_get($role .'-description', ''),
+ );
+
+ }
+ return system_settings_form($form);
+}