You are here

function realname_username_raw_token_validate in Real Name 7

E-mail settings form validation callback.

1 string reference to 'realname_username_raw_token_validate'
realname_form_user_admin_settings_alter in ./realname.module
Implements hook_form_FORM_ID_alter().

File

./realname.module, line 504
Provides token-based name displays for users.

Code

function realname_username_raw_token_validate(&$element, &$form_state) {
  $value = isset($element['#value']) ? $element['#value'] : $element['#default_value'];

  // Warns the site administrator that [user:name-raw], required to log in, is
  // missing. You can force the deactivation of this message by setting the
  // variable `realname_suppress_user_name_mail_validation` to TRUE (or any
  // value that converts to TRUE, like '1').
  if (!variable_get('realname_suppress_user_name_mail_validation', FALSE) && strpos($value, '[user:name-raw]') === FALSE) {
    drupal_set_message(t('The %element-title does not contain the <code>[user:name-raw]</code> token, which is necessary when using username for login.', array(
      '%element-title' => $element['#title'],
    )), 'warning');
  }
  return $element;
}