function user_relationships_type_edit_validate in User Relationships 5.2
Same name and namespace in other branches
- 5 user_relationships_actions.inc \user_relationships_type_edit_validate()
Validate the submitted relationship type
File
- ./
user_relationships_actions.inc, line 11
Code
function user_relationships_type_edit_validate($form_id, &$form_values) {
if ($form_values['action'] == 'edit' && db_result(db_query("SELECT name FROM {user_relationship_types}\n WHERE LOWER(name) = LOWER('%s')\n AND rtid != %d", $form_values['name'], $form_values['rtid'])) || $form_values['action'] == 'add' && db_result(db_query("SELECT name FROM {user_relationship_types} WHERE LOWER(name) = LOWER('%s')", $form_values['name']))) {
form_set_error('name', t('%name has already been used.', array(
'%name' => $form_values['name'],
)));
}
$expire = $form_values['expires_val'];
if (!is_numeric($expire) || (int) $expire < 0) {
form_set_error('expires_val', t('Expiration period must be an integer greater than or equal to 0.'));
}
}