You are here

function quickedit_field_node_author_edit_form_validate in Quick Edit 7

Form validation handler for quickedit_field_node_author_edit_form().

See also

node_validate()

quickedit_field_node_author_edit_form()

quickedit_field_node_author_edit_form_submit()

1 string reference to 'quickedit_field_node_author_edit_form_validate'
quickedit_field_node_author_edit_form in includes/node.inc
Form constructor; in-place editing form for node's 'author' "extra field".

File

includes/node.inc, line 78
Implements Quick Edit module hooks on behalf of node.module.

Code

function quickedit_field_node_author_edit_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,
    )));
  }
}