function oa_core_add_member_form_validate in Open Atrium Core 7.2
Validate handler; Add users to group.
File
- plugins/
content_types/ oa_core_add_member.inc, line 87
Code
function oa_core_add_member_form_validate($form, &$form_state) {
$account = user_load_by_name($form_state['values']['name']);
$space = $form['#space'];
if (!$account || empty($account->uid)) {
form_set_error('name', t('You have entered an invalid user name.'));
}
elseif (og_get_membership('node', $space->nid, 'user', $account->uid)) {
form_set_error('name', t('User %name is already a member of that @type.', array(
'@type' => drupal_strtolower(node_type_get_name($space->type)),
'%name' => format_username($account),
)));
}
}