function hosting_client_validate_suggest in Hosting 6.2
Same name and namespace in other branches
- 7.4 client/hosting_client.module \hosting_client_validate_suggest()
- 7.3 client/hosting_client.module \hosting_client_validate_suggest()
Helper for hosting_client_validate to suggest a new client name.
Parameters
$name: The client name being validated.
$internal: Whether this is an internal client name.
See also
1 call to hosting_client_validate_suggest()
- hosting_client_validate in client/
hosting_client.module - Implementation of hook_validate() .
File
- client/
hosting_client.module, line 283
Code
function hosting_client_validate_suggest($name, $internal = FALSE) {
$suggestion = FALSE;
$table = $internal ? 'hosting_client' : 'node';
$field = $internal ? 'uname' : 'title';
$name = $internal ? hosting_client_sanitize($name) : $name;
for ($i = 0; $i < 20; $i++) {
$nid = db_result(db_query("SELECT nid FROM {%s} WHERE %s = '%s'", $table, $field, $name . $i));
if (!$nid) {
return $name . $i;
}
}
}