You are here

function _auto_username_get_schema_name_maxlength in Automatic User Names 7

Fetch the maximum length of the {users}.name field from the schema.

Return value

An integer of the maximum username length allowed by the database.

2 calls to _auto_username_get_schema_name_maxlength()
auto_username_cleanstring in ./auto_username.inc
Clean up a string segment to be used in a username.
auto_username_settings_form in ./auto_username.admin.inc
@file Form builder; displays the auto_username settings form.

File

./auto_username.inc, line 275
Miscellaneous functions for auto_username.

Code

function _auto_username_get_schema_name_maxlength() {
  $maxlength =& drupal_static(__FUNCTION__);
  if (!isset($maxlength)) {
    $schema = drupal_get_schema('users');
    $maxlength = $schema['fields']['name']['length'];
  }
  return $maxlength;
}