function fape_field_edit_node_author_form_validate in Field API Pane Editor (FAPE) 7
Validates that the submitted author user actually exists.
See also
1 string reference to 'fape_field_edit_node_author_form_validate'
- fape_field_edit_node_author_form in ./
fape.module - Subform to edit the entity 'author' field.
File
- ./
fape.module, line 354 - Adds direct field editing via contextual links.
Code
function fape_field_edit_node_author_form_validate($form, &$form_state) {
$name = $form_state['values']['name'];
if (!empty($name) && !($account = user_load_by_name($name))) {
// The use of empty() is mandatory in the context of usernames
// as the empty string denotes the anonymous user. In case we
// are dealing with an anonymous user we set the user ID to 0.
form_set_error('name', t('The username %name does not exist.', array(
'%name' => $name,
)));
}
}