function duplicate_role_form_validate in Duplicate role 7
Form validate. Validate data before insert into database.
File
- ./
duplicate_role.module, line 94
Code
function duplicate_role_form_validate($form, &$form_state) {
$new_role_name = filter_xss($form_state['values']['new_role_name']);
$roles = user_roles();
if (in_array($new_role_name, $roles)) {
form_set_error('new_role_name', t('This role %role_name already exists. Please try a different name.', array(
'%role_name' => $new_role_name,
)));
}
}