You are here

function social_content_element_validate_user_name in Social Content 7.2

Form element validation handler to check for valid usernames.

This is used on the author field, on the global/instance settings form.

1 string reference to 'social_content_element_validate_user_name'
SocialContent::instanceSettingsForm in ./social_content.class.inc
Instance settings form.

File

./social_content.module, line 301
Social Content module.

Code

function social_content_element_validate_user_name($element, &$form_state) {
  if (!empty($element['#value']) && !($account = user_load_by_name($element['#value']))) {
    form_error($element, t('The username %name does not exist.', array(
      '%name' => $element['#value'],
    )));
  }
}