function gadd_add_member_form in Group 7
Form for forcibly adding users.
1 string reference to 'gadd_add_member_form'
- gadd_menu in modules/
gadd/ gadd.router.inc - Implements hook_menu().
File
- modules/
gadd/ forms/ gadd.inc, line 10 - Group add member UI.
Code
function gadd_add_member_form($form, &$form_state, Group $group) {
$form['user'] = array(
'#type' => 'textfield',
'#title' => t('Username'),
'#description' => t('Enter the username of the person you want to add.'),
'#autocomplete_path' => 'user/autocomplete',
'#required' => TRUE,
);
$group_roles = group_type_load($group->type)
->getRoles(FALSE);
foreach ($group_roles as &$group_role) {
$group_role = $group_role
->label();
}
$form['roles'] = array(
'#type' => 'checkboxes',
'#title' => t('Roles'),
'#description' => t('Select the roles the member will receive.'),
'#options' => $group_roles,
'#default_value' => array(),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Add member'),
);
return $form;
}