diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-10-11 19:44:35 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-10-11 19:44:35 +0000 |
commit | 75fe6b6c0ae85d2b53cb803d5b028b050fd6d454 (patch) | |
tree | 70ea02551300ed5a696b4d289cfc4722924d58ca /modules/user/user.module | |
parent | ecf5ed57d66a182ae0e269942169e0a6cf3a3912 (diff) | |
download | brdo-75fe6b6c0ae85d2b53cb803d5b028b050fd6d454.tar.gz brdo-75fe6b6c0ae85d2b53cb803d5b028b050fd6d454.tar.bz2 |
- Patch #33752 by chx, adrian, et al: another batch of form API changes/fixes.
Diffstat (limited to 'modules/user/user.module')
-rw-r--r-- | modules/user/user.module | 170 |
1 files changed, 85 insertions, 85 deletions
diff --git a/modules/user/user.module b/modules/user/user.module index f71713e23..2647d7ab4 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -467,7 +467,7 @@ function user_search($op = 'search', $keys = null) { */ function user_user($type, &$edit, &$user, $category = NULL) { if ($type == 'view') { - $form['member'] = array(type => 'item', title => t('Member for'), value => format_interval(time() - $user->created)); + $form['member'] = array('#type' => 'item', '#title' => t('Member for'), '#value' => format_interval(time() - $user->created)); return array(t('History') => array('history'=> drupal_get_form('member', $form))); } @@ -500,8 +500,8 @@ function user_block($op = 'list', $delta = 0, $edit = array()) { } else if ($op == 'configure' && $delta == 3) { $period = drupal_map_assoc(array(30, 60, 120, 180, 300, 600, 900, 1800, 2700, 3600, 5400, 7200, 10800, 21600, 43200, 86400), 'format_interval'); - $form['user_block_seconds_online'] = array(type => 'select', title => t('User activity'), default_value => variable_get('user_block_seconds_online', 900), options => $period, description => t('A user is considered online for this long after they have last viewed a page.')); - $form['user_block_max_list_count'] = array(type => 'select', title => t('User list length'), default_value => variable_get('user_block_max_list_count', 10), options => drupal_map_assoc(array(0, 5, 10, 15, 20, 25, 30, 40, 50, 75, 100)), description => t('Maximum number of currently online users to display.')); + $form['user_block_seconds_online'] = array('#type' => 'select', '#title' => t('User activity'), '#default_value' => variable_get('user_block_seconds_online', 900), '#options' => $period, '#description' => t('A user is considered online for this long after they have last viewed a page.')); + $form['user_block_max_list_count'] = array('#type' => 'select', '#title' => t('User list length'), '#default_value' => variable_get('user_block_max_list_count', 10), '#options' => drupal_map_assoc(array(0, 5, 10, 15, 20, 25, 30, 40, 50, 75, 100)), '#description' => t('Maximum number of currently online users to display.')); //return drupal_get_form('user_block', $form); return $form; @@ -517,9 +517,9 @@ function user_block($op = 'list', $delta = 0, $edit = array()) { case 0: // For usability's sake, avoid showing two login forms on one page. if (!$user->uid && !(arg(0) == 'user' && !is_numeric(arg(1)))) { - $form['name'] = array(type => 'textfield', title => t('Username'), maxlength => 64, size => 15); - $form['pass'] = array(type => 'password', title => t('Password'), maxlength => 64, size => 15); - $form['submit'] = array(type => 'submit', value => t('Log in')); + $form['name'] = array('#type' => 'textfield', '#title' => t('Username'), '#maxlength' => 64, '#size' => 15); + $form['pass'] = array('#type' => 'password', '#title' => t('Password'), '#maxlength' => 64, '#size' => 15); + $form['submit'] = array('#type' => 'submit', '#value' => t('Log in')); $output .= drupal_get_form('user_login_block', $form, 'user_login'); if (variable_get('user_register', 1)) { $items[] = l(t('Create new account'), 'user/register', array('title' => t('Create a new user account.'))); @@ -877,7 +877,7 @@ function user_login($edit = array(), $msg = '') { // Display error message (if any): if ($error) { - $form['error'] = array(type => 'value', value => 1); + $form['error'] = array('#type' => 'value', '#value' => 1); drupal_set_message($error, 'error'); } @@ -885,15 +885,15 @@ function user_login($edit = array(), $msg = '') { if ($msg) { $output .= "<p>$msg</p>"; } - $form['name'] = array(type => 'textfield', title => t('Username'), size => 30, maxlength => 64, required => TRUE); + $form['name'] = array('#type' => 'textfield', '#title' => t('Username'), '#size' => 30, '#maxlength' => 64, '#required' => TRUE); if (count(user_auth_help_links()) > 0) { - $form['name'][description] = t('Enter your %s username, or an ID from one of our affiliates: %a.', array('%s' => variable_get('site_name', 'local'), '%a' => implode(', ', user_auth_help_links()))); + $form['name']['#description'] = t('Enter your %s username, or an ID from one of our affiliates: %a.', array('%s' => variable_get('site_name', 'local'), '%a' => implode(', ', user_auth_help_links()))); } else { - $form['name'][description] = t('Enter your %s username.', array('%s' => variable_get('site_name', 'local'))); + $form['name']['#description'] = t('Enter your %s username.', array('%s' => variable_get('site_name', 'local'))); } - $form['pass'] = array(type => 'password', title => t('Password'), size => 30, maxlength => 64, description => t('Enter the password that accompanies your username.'), required => TRUE); - $form['submit'] = array(type => 'submit', value => t('Log in'), weight => 2); + $form['pass'] = array('#type' => 'password', '#title' => t('Password'), '#size' => 30, '#maxlength' => 64, '#description' => t('Enter the password that accompanies your username.'), '#required' => TRUE); + $form['submit'] = array('#type' => 'submit', '#value' => t('Log in'), '#weight' => 2); return drupal_get_form('user_login', $form); } @@ -1004,9 +1004,9 @@ function user_pass() { drupal_set_message(t('You must provide either a username or e-mail address.'), 'error'); } // Display form: - $form['name'] = array(type => 'textfield', title => t('Username'), default_value => $edit['name'], size => 30, maxlength => 64); - $form['mail'] = array(type => 'textfield', title => t('E-mail address'), default_value => $edit['mail'], size => 30, maxlength => 64); - $form['submit'] = array(type => 'submit', value => t('E-mail new password')); + $form['name'] = array('#type' => 'textfield', '#title' => t('Username'), '#default_value' => $edit['name'], '#size' => 30, '#maxlength' => 64); + $form['mail'] = array('#type' => 'textfield', '#title' => t('E-mail address'), '#default_value' => $edit['mail'], '#size' => 30, '#maxlength' => 64); + $form['submit'] = array('#type' => 'submit', '#value' => t('E-mail new password')); return drupal_get_form('user_logout', $form); } } @@ -1093,11 +1093,11 @@ function user_register($edit = array()) { if ($account->uid == 1) { user_mail($edit['mail'], t('drupal user account details for %s', array('%s' => $edit['name'])), strtr(t("%username,\n\nYou may now login to %uri using the following username and password:\n\n username: %username\n password: %password\n\n%edit_uri\n\n--drupal"), $variables), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from"); // This should not be t()'ed. No point as its only shown once in the sites lifetime, and it would be bad to store the password. - $form['instructions'] = array(type => 'markup', value => "<p>Welcome to Drupal. You are user #1, which gives you full and immediate access. All future registrants will receive their passwords via e-mail, so please configure your e-mail settings using the Administration pages.</p><p> Your password is <strong>$pass</strong>. You may change your password on the next page.</p><p>Please login below.</p>"); - $form[action] = 'user/'. $account->uid .'/edit'; - $form['name'] = array(type => 'hidden', value => $account->name); - $form['pass'] = array(type => 'hidden', value => $pass); - $form['submit'] = array(type => 'submit', value => t('Log in')); + $form['instructions'] = array('#type' => 'markup', '#value' => "<p>Welcome to Drupal. You are user #1, which gives you full and immediate access. All future registrants will receive their passwords via e-mail, so please configure your e-mail settings using the Administration pages.</p><p> Your password is <strong>$pass</strong>. You may change your password on the next page.</p><p>Please login below.</p>"); + $form['#action'] = 'user/'. $account->uid .'/edit'; + $form['name'] = array('#type' => 'hidden', '#value' => $account->name); + $form['pass'] = array('#type' => 'hidden', '#value' => $pass); + $form['submit'] = array('#type' => 'submit', '#value' => t('Log in')); return drupal_get_form('user_register', $form); } else { @@ -1127,22 +1127,22 @@ function user_register($edit = array()) { } // Display the registration form. - $form['user_registration_help'] = array(type => 'markup', value => variable_get('user_registration_help', '')); + $form['user_registration_help'] = array('#type' => 'markup', '#value' => variable_get('user_registration_help', '')); $affiliates = user_auth_help_links(); if (!$admin && count($affiliates) > 0) { $affiliates = implode(', ', $affiliates); - $form['affiliates'] = array(type => 'markup', value => '<p>'. t('Note: if you have an account with one of our affiliates (%s), you may <a href="%login_uri">login now</a> instead of registering.', array('%s' => $affiliates, '%login_uri' => url('user'))) .'</p>'); + $form['affiliates'] = array('#type' => 'markup', '#value' => '<p>'. t('Note: if you have an account with one of our affiliates (%s), you may <a href="%login_uri">login now</a> instead of registering.', array('%s' => $affiliates, '%login_uri' => url('user'))) .'</p>'); } - $form['name'] = array(type => 'textfield', title => t('Username'), default_value => $edit['name'], size => 30, maxlength => 64, description => t('Your full name or your preferred username; only letters, numbers and spaces are allowed.'), required => TRUE); - $form['mail'] = array(type => 'textfield', title => t('E-mail address'), default_value => $edit['mail'], size => 30, maxlength => 64, description => t('A password and instructions will be sent to this e-mail address, so make sure it is accurate.'), required => TRUE); + $form['name'] = array('#type' => 'textfield', '#title' => t('Username'), '#default_value' => $edit['name'], '#size' => 30, '#maxlength' => 64, '#description' => t('Your full name or your preferred username; only letters, numbers and spaces are allowed.'), '#required' => TRUE); + $form['mail'] = array('#type' => 'textfield', '#title' => t('E-mail address'), '#default_value' => $edit['mail'], '#size' => 30, '#maxlength' => 64, '#description' => t('A password and instructions will be sent to this e-mail address, so make sure it is accurate.'), '#required' => TRUE); if ($admin) { - $form['pass'] = array(type => 'password', title => t('Password'), default_value => $edit['pass'], size => 30, maxlength => 55, description => t('Provide a password for the new account.'), required => TRUE); + $form['pass'] = array('#type' => 'password', '#title' => t('Password'), '#default_value' => $edit['pass'], '#size' => 30, '#maxlength' => 55, '#description' => t('Provide a password for the new account.'), '#required' => TRUE); } $extra = _user_forms($edit, $account, $category, 'register'); // Only display form_group around default fields if there are other groups. if ($extra) { - $form['account'] = array(type => 'fieldset', value => t('Account information')); + $form['account'] = array('#type' => 'fieldset', '#value' => t('Account information')); $form['account']['name'] = $form['name']; $form['account']['mail'] = $form['mail']; $form['account']['pass'] = $form['pass']; @@ -1151,30 +1151,30 @@ function user_register($edit = array()) { unset($form['pass']); $form = array_merge($form, $extra); } - $form['submit'] = array(type => 'submit', value => t('Create new account'), weight => 30); + $form['submit'] = array('#type' => 'submit', '#value' => t('Create new account'), '#weight' => 30); return drupal_get_form('user_register', $form); } function user_edit_form($uid, $edit) { // Account information: - $form['account'] = array(type => 'fieldset', title => t('Account information'), weight => 0); - $form['account']['name'] = array(type => 'textfield', title => t('Username'), default_value => $edit['name'], size => 60, maxlength => 55, description => t('Your full name or your preferred username: only letters, numbers and spaces are allowed.'), required => TRUE); - $form['account']['mail'] = array(type => 'textfield', title => t('E-mail address'), default_value => $edit['mail'], size => 60, maxlength => 55, description => t('Insert a valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.'), required => TRUE); - $form['account']['pass'] = array(type => 'item', title => t('Password'), value => '<input type="password" class="form-password" name="edit[pass1]" size="12" maxlength="24" /> <input type="password" class="form-password" name="edit[pass2]" size="12" maxlength="24" />', required => true); + $form['account'] = array('#type' => 'fieldset', '#title' => t('Account information'), '#weight' => 0); + $form['account']['name'] = array('#type' => 'textfield', '#title' => t('Username'), '#default_value' => $edit['name'], '#size' => 60, '#maxlength' => 55, '#description' => t('Your full name or your preferred username: only letters, numbers and spaces are allowed.'), '#required' => TRUE); + $form['account']['mail'] = array('#type' => 'textfield', '#title' => t('E-mail address'), '#default_value' => $edit['mail'], '#size' => 60, '#maxlength' => 55, '#description' => t('Insert a valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.'), '#required' => TRUE); + $form['account']['pass'] = array('#type' => 'item', '#title' => t('Password'), '#value' => '<input type="password" class="form-password" name="edit[pass1]" size="12" maxlength="24" /> <input type="password" class="form-password" name="edit[pass2]" size="12" maxlength="24" />', '#required' => true); if (user_access('administer access control')) { - $form['account']['status'] = array(type => 'radios', title => t('Status'), default_value => $edit['status'], options => array(t('Blocked'), t('Active'))); - $form['account']['roles'] = array(type => 'checkboxes', title => t('Roles'), default_value => array_keys($edit['roles']), options => user_roles(1), description => t('Select at least one role. The user receives the combined permissions of all of the selected roles.'), required => TRUE); + $form['account']['status'] = array('#type' => 'radios', '#title' => t('Status'), '#default_value' => $edit['status'], '#options' => array(t('Blocked'), t('Active'))); + $form['account']['roles'] = array('#type' => 'checkboxes', '#title' => t('Roles'), '#default_value' => array_keys($edit['roles']), '#options' => user_roles(1), '#description' => t('Select at least one role. The user receives the combined permissions of all of the selected roles.'), '#required' => TRUE); } // Picture/avatar: if (variable_get('user_pictures', 0)) { - $form['picture'] = array(type => 'fieldset', title => t('Picture'), weight => 1); + $form['picture'] = array('#type' => 'fieldset', '#title' => t('Picture'), '#weight' => 1); if ($edit['picture'] && ($picture = theme('user_picture', array2object($edit)))) { - $form['picture']['current_picture'] = array(type => 'markup', value => $picture); - $form['picture']['picture_delete'] = array(type => 'checkbox', title => t('Delete picture'), return_value => 1, default_value => 0, description => t('Check this box to delete your current picture.')); + $form['picture']['current_picture'] = array('#type' => 'markup', '#value' => $picture); + $form['picture']['picture_delete'] = array('#type' => 'checkbox', '#title' => t('Delete picture'), '#return_value' => 1, '#default_value' => 0, '#description' => t('Check this box to delete your current picture.')); } - $form['picture']['picture'] = array(type => 'file', title => t('Upload picture'), size => 48, description => t('Your virtual face or picture. Maximum dimensions are %dimensions and the maximum size is %size kB.', array('%dimensions' => variable_get('user_picture_dimensions', '85x85'), '%size' => variable_get('user_picture_file_size', '30'))) .' '. variable_get('user_picture_guidelines', '')); + $form['picture']['picture'] = array('#type' => 'file', '#title' => t('Upload picture'), '#size' => 48, '#description' => t('Your virtual face or picture. Maximum dimensions are %dimensions and the maximum size is %size kB.', array('%dimensions' => variable_get('user_picture_dimensions', '85x85'), '%size' => variable_get('user_picture_file_size', '30'))) .' '. variable_get('user_picture_guidelines', '')); } return $form; @@ -1284,11 +1284,11 @@ function user_edit($category = 'account') { } $form = _user_forms($edit, $account, $category); - $form['submit'] = array(type => 'submit', value => t('Submit'), weight => 30); + $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'), '#weight' => 30); if (user_access('administer users')) { - $form['delete'] = array(type => 'submit', value => t('Delete'), weight => 30); + $form['delete'] = array('#type' => 'submit', '#value' => t('Delete'), '#weight' => 30); } - $form[attributes] = array('enctype' => 'multipart/form-data'); + $form['#attributes'] = array('enctype' => 'multipart/form-data'); drupal_set_title($account->name); return drupal_get_form('user_edit', $form); @@ -1412,24 +1412,24 @@ function user_admin_access_check() { } } - $form['user'] = array(type => 'fieldset', title => t('Username')); - $form['user']['test'] = array(type => 'textfield', title => '', description => t('Enter a username to check if it will be denied or allowed.'), size => 30, maxlength => 64); - $form['user']['type'] = array(type => 'hidden', value => 'user'); - $form['user']['submit'] = array(type => 'submit', value => t('Check username')); + $form['user'] = array('#type' => 'fieldset', '#title' => t('Username')); + $form['user']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter a username to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => 64); + $form['user']['type'] = array('#type' => 'hidden', '#value' => 'user'); + $form['user']['submit'] = array('#type' => 'submit', '#value' => t('Check username')); $output .= drupal_get_form('check_user', $form); unset($form); // prevent endless loop? - $form['mail'] = array(type => 'fieldset', title => t('E-mail')); - $form['mail']['test'] = array(type => 'textfield', title => '', description => t('Enter an e-mail address to check if it will be denied or allowed.'), size => 30, maxlength => 64); - $form['mail']['type'] = array(type => 'hidden', value => 'mail'); - $form['mail']['submit'] = array(type => 'submit', value => t('Check e-mail')); + $form['mail'] = array('#type' => 'fieldset', '#title' => t('E-mail')); + $form['mail']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter an e-mail address to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => 64); + $form['mail']['type'] = array('#type' => 'hidden', '#value' => 'mail'); + $form['mail']['submit'] = array('#type' => 'submit', '#value' => t('Check e-mail')); $output .= drupal_get_form('check_mail', $form); unset($form); // prevent endless loop? - $form['host'] = array(type => 'fieldset', title => t('Hostname')); - $form['host']['test'] = array(type => 'textfield', title => '', description => t('Enter a hostname or IP address to check if it will be denied or allowed.'), size => 30, maxlength => 64); - $form['host']['type'] = array(type => 'hidden', value => 'host'); - $form['host']['submit'] = array(type => 'submit', value => t('Check hostname')); + $form['host'] = array('#type' => 'fieldset', '#title' => t('Hostname')); + $form['host']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter a hostname or IP address to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => 64); + $form['host']['type'] = array('#type' => 'hidden', '#value' => 'host'); + $form['host']['submit'] = array('#type' => 'submit', '#value' => t('Check hostname')); $output .= drupal_get_form('check_host', $form); unset($form); // prevent endless loop? @@ -1457,7 +1457,7 @@ function user_admin_access_add($mask = NULL, $type = NULL) { } $form = _user_admin_access_form($edit); - $form['submit'] = array(type => 'submit', value => t('Add rule')); + $form['submit'] = array('#type' => 'submit', '#value' => t('Add rule')); return drupal_get_form('access_rule', $form); } @@ -1470,7 +1470,7 @@ function user_admin_access_delete($aid = 0) { $edit = db_fetch_object(db_query('SELECT aid, type, status, mask FROM {access} WHERE aid = %d', $aid)); $form = array(); - $form['aid'] = array(type => 'hidden', value => $aid); + $form['aid'] = array('#type' => 'hidden', '#value' => $aid); $output = confirm_form('user_admin_access_delete_confirm', $form, t('Are you sure you want to delete the %type rule for %rule?', array('%type' => $access_types[$edit->type], '%rule' => theme('placeholder', $edit->mask))), 'admin/access/rules', @@ -1504,15 +1504,15 @@ function user_admin_access_edit($aid = 0) { $edit = db_fetch_array(db_query('SELECT aid, type, status, mask FROM {access} WHERE aid = %d', $aid)); } $form = _user_admin_access_form($edit); - $form['submit'] = array(type => 'submit', value => t('Save rule')); + $form['submit'] = array('#type' => 'submit', '#value' => t('Save rule')); return drupal_get_form('access_rule', $form); } function _user_admin_access_form($edit) { - $form['status'] = array(type => 'radios', title => t('Access type'), default_value => $edit['status'], options => array('1' => t('Allow'), '0' => t('Deny'))); - $form['type'] = array(type => 'radios', title => t('Rule type'), default_value => $edit['type'], options => array('user' => t('Username'), 'mail' => t('E-mail'), 'host' => t('Host'), default_value => 'host')); - $form['mask'] = array(type => 'textfield', title => t('Mask'), default_value => $edit['mask'], size => 30, maxlength => 64, description => '%: '. t('Matches any number of characters, even zero characters') .'.<br />_: '. t('Matches exactly one character.'), required => TRUE); + $form['status'] = array('#type' => 'radios', '#title' => t('Access type'), '#default_value' => $edit['status'], '#options' => array('1' => t('Allow'), '0' => t('Deny'))); + $form['type'] = array('#type' => 'radios', '#title' => t('Rule type'), '#default_value' => $edit['type'], '#options' => array('user' => t('Username'), 'mail' => t('E-mail'), 'host' => t('Host'), '#default_value' => 'host')); + $form['mask'] = array('#type' => 'textfield', '#title' => t('Mask'), '#default_value' => $edit['mask'], '#size' => 30, '#maxlength' => 64, '#description' => '%: '. t('Matches any number of characters, even zero characters') .'.<br />_: '. t('Matches exactly one character.'), '#required' => TRUE); return $form; } @@ -1575,11 +1575,11 @@ function user_admin_perm() { $options = array(); foreach (module_list() as $module) { if ($permissions = module_invoke($module, 'perm')) { - $form['permission'][] = array(type => 'markup', value => t('%module module', array('%module' => $module))); + $form['permission'][] = array('#type' => 'markup', '#value' => t('%module module', array('%module' => $module))); asort($permissions); foreach ($permissions as $perm) { $options[$perm] = ''; - $form['permission'][$perm] = array(type => 'markup', value => t($perm)); + $form['permission'][$perm] = array('#type' => 'markup', '#value' => t($perm)); foreach ($role_names as $rid => $name) { // Builds arrays for checked boxes for each role if (strstr($role_permissions[$rid], $perm)) { @@ -1591,10 +1591,10 @@ function user_admin_perm() { } // Have to build checkboxes here after checkbox arrays are built foreach ($role_names as $rid => $name) { - $form['checkboxes'][$rid] = array(type => 'checkboxes', options => $options, default_value => $status[$rid], tree => TRUE); - $form['role_names'][$rid] = array(type => 'markup', value => $name, tree => TRUE); + $form['checkboxes'][$rid] = array('#type' => 'checkboxes', '#options' => $options, '#default_value' => $status[$rid], '#tree' => TRUE); + $form['role_names'][$rid] = array('#type' => 'markup', '#value' => $name, '#tree' => TRUE); } - $form['submit'] = array(type => 'submit', value => t('Save permissions')); + $form['submit'] = array('#type' => 'submit', '#value' => t('Save permissions')); return drupal_get_form('user_admin_perm', $form); } @@ -1708,13 +1708,13 @@ function user_admin_role() { else if ($id) { // Display the role form. $role = db_fetch_object(db_query('SELECT * FROM {role} WHERE rid = %d', $id)); - $form['name'] = array(type => 'textfield', title => t('Role name'), default_value => $role->name, size => 30, maxlength => 64, description => t('The name for this role. Example: "moderator", "editorial board", "site architect".')); - $form['submit'] = array(type => 'submit', value => t('Save role')); - $form['delete'] = array(type => 'submit', value => t('Delete role')); + $form['name'] = array('#type' => 'textfield', '#title' => t('Role name'), '#default_value' => $role->name, '#size' => 30, '#maxlength' => 64, '#description' => t('The name for this role. Example: "moderator", "editorial board", "site architect".')); + $form['submit'] = array('#type' => 'submit', '#value' => t('Save role')); + $form['delete'] = array('#type' => 'submit', '#value' => t('Delete role')); return drupal_get_form('user_admin_role', $form); } - $form['name'] = array(type => 'textfield', size => 32, maxlength => 64); - $form['submit'] = array(type => 'submit', value => t('Add role')); + $form['name'] = array('#type' => 'textfield', '#size' => 32, '#maxlength' => 64); + $form['submit'] = array('#type' => 'submit', '#value' => t('Add role')); return drupal_get_form('user_admin_new_role', $form); } @@ -1765,18 +1765,18 @@ function user_admin_account() { function user_configure() { // User registration settings. - $form['registration'] = array(type => 'fieldset', title => t('User registration settings')); - $form['registration']['user_register'] = array(type => 'radios', title => t('Public registrations'), default_value => variable_get('user_register', 1), options => array(t('Only site administrators can create new user accounts.'), t('Visitors can create accounts and no administrator approval is required.'), t('Visitors can create accounts but administrator approval is required.'))); - $form['registration']['user_registration_help'] = array(type => 'textarea', title => t('User registration guidelines'), default_value => variable_get('user_registration_help', ''), cols => 60, rows => 5, description => t('This text is displayed at the top of the user registration form. It\'s useful for helping or instructing your users.')); + $form['registration'] = array('#type' => 'fieldset', '#title' => t('User registration settings')); + $form['registration']['user_register'] = array('#type' => 'radios', '#title' => t('Public registrations'), '#default_value' => variable_get('user_register', 1), '#options' => array(t('Only site administrators can create new user accounts.'), t('Visitors can create accounts and no administrator approval is required.'), t('Visitors can create accounts but administrator approval is required.'))); + $form['registration']['user_registration_help'] = array('#type' => 'textarea', '#title' => t('User registration guidelines'), '#default_value' => variable_get('user_registration_help', ''), '#cols' => 60, '#rows' => 5, '#description' => t('This text is displayed at the top of the user registration form. It\'s useful for helping or instructing your users.')); // User e-mail settings. - $form['email'] = array(type => 'fieldset', title => t('User email settings')); - $form['email']['user_mail_welcome_subject'] = array(type => 'textfield', title => t('Subject of welcome e-mail'), default_value => _user_mail_text('welcome_subject'), size => 60, maxlength => 180, description => t('Customize the subject of your welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %date, %login_uri, %edit_uri, %login_url.'); - $form['email']['user_mail_welcome_body'] = array(type => 'textarea', title => t('Body of welcome e-mail'), default_value => _user_mail_text('welcome_body'), cols => 60, rows => 15, description => t('Customize the body of the welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %login_uri, %edit_uri, %login_url.'); - $form['email']['user_mail_approval_subject'] = array(type => 'textfield', title => t('Subject of welcome e-mail (awaiting admin approval)'), default_value => _user_mail_text('approval_subject'), size => 60, maxlength => 180, description => t('Customize the subject of your awaiting approval welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %date, %login_uri, %edit_uri, %login_url.'); - $form['email']['user_mail_approval_body'] = array(type => 'textarea', title => t('Body of welcome e-mail (awaiting admin approval)'), default_value => _user_mail_text('approval_body'), cols => 60, rows => 15, description => t('Customize the body of the awaiting approval welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %login_uri, %edit_uri, %login_url.'); - $form['email']['user_mail_pass_subject'] = array(type => 'textfield', title => t('Subject of password recovery e-mail'), default_value => _user_mail_text('pass_subject'), size => 60, maxlength => 180, description => t('Customize the Subject of your forgotten password e-mail.') .' '. t('Available variables are:') .' %username, %site, %login_url, %uri, %uri_brief, %mailto, %date, %login_uri, %edit_uri.'); - $form['email']['user_mail_pass_body'] = array(type => 'textarea', title => t('Body of password recovery e-mail'), default_value => _user_mail_text('pass_body'), cols => 60, rows => 15, description => t('Customize the body of the forgotten password e-mail.') .' '. t('Available variables are:') .' %username, %site, %login_url, %uri, %uri_brief, %mailto, %login_uri, %edit_uri.'); + $form['email'] = array('#type' => 'fieldset', '#title' => t('User email settings')); + $form['email']['user_mail_welcome_subject'] = array('#type' => 'textfield', '#title' => t('Subject of welcome e-mail'), '#default_value' => _user_mail_text('welcome_subject'), '#size' => 60, '#maxlength' => 180, '#description' => t('Customize the subject of your welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %date, %login_uri, %edit_uri, %login_url.'); + $form['email']['user_mail_welcome_body'] = array('#type' => 'textarea', '#title' => t('Body of welcome e-mail'), '#default_value' => _user_mail_text('welcome_body'), '#cols' => 60, '#rows' => 15, '#description' => t('Customize the body of the welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %login_uri, %edit_uri, %login_url.'); + $form['email']['user_mail_approval_subject'] = array('#type' => 'textfield', '#title' => t('Subject of welcome e-mail (awaiting admin approval)'), '#default_value' => _user_mail_text('approval_subject'), '#size' => 60, '#maxlength' => 180, '#description' => t('Customize the subject of your awaiting approval welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %date, %login_uri, %edit_uri, %login_url.'); + $form['email']['user_mail_approval_body'] = array('#type' => 'textarea', '#title' => t('Body of welcome e-mail (awaiting admin approval)'), '#default_value' => _user_mail_text('approval_body'), '#cols' => 60, '#rows' => 15, '#description' => t('Customize the body of the awaiting approval welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %login_uri, %edit_uri, %login_url.'); + $form['email']['user_mail_pass_subject'] = array('#type' => 'textfield', '#title' => t('Subject of password recovery e-mail'), '#default_value' => _user_mail_text('pass_subject'), '#size' => 60, '#maxlength' => 180, '#description' => t('Customize the Subject of your forgotten password e-mail.') .' '. t('Available variables are:') .' %username, %site, %login_url, %uri, %uri_brief, %mailto, %date, %login_uri, %edit_uri.'); + $form['email']['user_mail_pass_body'] = array('#type' => 'textarea', '#title' => t('Body of password recovery e-mail'), '#default_value' => _user_mail_text('pass_body'), '#cols' => 60, '#rows' => 15, '#description' => t('Customize the body of the forgotten password e-mail.') .' '. t('Available variables are:') .' %username, %site, %login_url, %uri, %uri_brief, %mailto, %login_uri, %edit_uri.'); // If picture support is enabled, check whether the picture directory exists: if (variable_get('user_pictures', 0)) { @@ -1784,13 +1784,13 @@ function user_configure() { file_check_directory($picture_path, 1, 'user_picture_path'); } - $form['pictures'] = array(type => 'fieldset', title => t('Pictures')); - $form['pictures']['user_pictures'] = array(type => 'radios', title => t('Picture support'), default_value => variable_get('user_pictures', 0), options => array(t('Disabled'), t('Enabled')), description => t('Enable picture support.')); - $form['pictures']['user_picture_path'] = array(type => 'textfield', title => t('Picture image path'), default_value => variable_get('user_picture_path', 'pictures'), size => 30, maxlength => 255, description => t('Subdirectory in the directory "%dir" where pictures will be stored.', array('%dir' => variable_get('file_directory_path', 'files') .'/'))); - $form['pictures']['user_picture_default'] = array(type => 'textfield', title => t('Default picture'), default_value => variable_get('user_picture_default', ''), size => 30, maxlength => 255, description => t('URL of picture to display for users with no custom picture selected. Leave blank for none.')); - $form['pictures']['user_picture_dimensions'] = array(type => 'textfield', title => t('Picture maximum dimensions'), default_value => variable_get('user_picture_dimensions', '85x85'), size => 15, maxlength => 10, description => t('Maximum dimensions for pictures.')); - $form['pictures']['user_picture_file_size'] = array(type => 'textfield', title => t('Picture maximum file size'), default_value => variable_get('user_picture_file_size', '30'), size => 15, maxlength => 10, description => t('Maximum file size for pictures, in kB.')); - $form['pictures']['user_picture_guidelines'] = array(type => 'textarea', title => t('Picture guidelines'), default_value => variable_get('user_picture_guidelines', ''), cols => 60, rows => 5, description => t('This text is displayed at the picture upload form in addition to the default guidelines. It\'s useful for helping or instructing your users.')); + $form['pictures'] = array('#type' => 'fieldset', '#title' => t('Pictures')); + $form['pictures']['user_pictures'] = array('#type' => 'radios', '#title' => t('Picture support'), '#default_value' => variable_get('user_pictures', 0), '#options' => array(t('Disabled'), t('Enabled')), '#description' => t('Enable picture support.')); + $form['pictures']['user_picture_path'] = array('#type' => 'textfield', '#title' => t('Picture image path'), '#default_value' => variable_get('user_picture_path', 'pictures'), '#size' => 30, '#maxlength' => 255, '#description' => t('Subdirectory in the directory "%dir" where pictures will be stored.', array('%dir' => variable_get('file_directory_path', 'files') .'/'))); + $form['pictures']['user_picture_default'] = array('#type' => 'textfield', '#title' => t('Default picture'), '#default_value' => variable_get('user_picture_default', ''), '#size' => 30, '#maxlength' => 255, '#description' => t('URL of picture to display for users with no custom picture selected. Leave blank for none.')); + $form['pictures']['user_picture_dimensions'] = array('#type' => 'textfield', '#title' => t('Picture maximum dimensions'), '#default_value' => variable_get('user_picture_dimensions', '85x85'), '#size' => 15, '#maxlength' => 10, '#description' => t('Maximum dimensions for pictures.')); + $form['pictures']['user_picture_file_size'] = array('#type' => 'textfield', '#title' => t('Picture maximum file size'), '#default_value' => variable_get('user_picture_file_size', '30'), '#size' => 15, '#maxlength' => 10, '#description' => t('Maximum file size for pictures, in kB.')); + $form['pictures']['user_picture_guidelines'] = array('#type' => 'textarea', '#title' => t('Picture guidelines'), '#default_value' => variable_get('user_picture_guidelines', ''), '#cols' => 60, '#rows' => 5, '#description' => t('This text is displayed at the picture upload form in addition to the default guidelines. It\'s useful for helping or instructing your users.')); return system_settings_form('user_configure_settings', $form); } |