function administerusersbyrole_form_user_profile_form_alter in Administer Users by Role 7.2
Same name and namespace in other branches
- 7 administerusersbyrole.module \administerusersbyrole_form_user_profile_form_alter()
Implements hook_form_FORM_ID_alter().
Add extra visibility depending on our permissions.
File
- ./
administerusersbyrole.module, line 209 - Provides fine-grained permissions for creating, editing, and deleting users.
Code
function administerusersbyrole_form_user_profile_form_alter(&$form, &$form_state) {
$account = $form['#user'];
// We just check against this module's own permissions.
// Don't check against the permissions in Drupal core, as those checks have already done and are subtle.
// (For example, users can't necesarily change their own username and can't block their own account.)
if (_administerusersbyrole_check_access($account, 'edit')) {
$form['account']['name']['#access'] = TRUE;
$form['account']['status']['#access'] = TRUE;
}
if (_administerusersbyrole_check_access($account, 'cancel')) {
$form['actions']['cancel']['#access'] = TRUE;
}
}