function og_ui_user_admin_roles_validate in Organic groups 7
1 string reference to 'og_ui_user_admin_roles_validate'
- og_ui_user_admin_roles in og_ui/
og_ui.admin.inc - Menu callback: administer roles.
File
- og_ui/
og_ui.admin.inc, line 410 - Admin settings for Organic groups module.
Code
function og_ui_user_admin_roles_validate($form, &$form_state) {
if (!empty($form_state['values']['name'])) {
$roles = og_roles($form_state['values']['gid']);
$unique_name = TRUE;
if (!empty($form_state['values']['rid'])) {
$role = og_role_load($form_state['values']['rid']);
$unique_name = $role->name != $form_state['values']['name'];
}
if ($unique_name && in_array($form_state['values']['name'], $roles)) {
form_set_error('name', t('The role name %name already exists. Please choose another role name.', array(
'%name' => $form_state['values']['name'],
)));
}
}
}