function ad_channel_admin_channel_validate in Advertisement 6.3
Same name and namespace in other branches
- 5.2 channel/ad_channel.module \ad_channel_admin_channel_validate()
- 6.2 channel/ad_channel.module \ad_channel_admin_channel_validate()
- 7 channel/ad_channel.module \ad_channel_admin_channel_validate()
Validate the channel.
File
- channel/
ad_channel.module, line 1219 - Ad Channel module.
Code
function ad_channel_admin_channel_validate($form, &$form_state) {
$chid = 0;
if ($form_state['values']['op'] == t('Create')) {
$chid = db_result(db_query("SELECT chid FROM {ad_channel} WHERE name = '%s'", $form_state['values']['name']));
}
else {
if ($form_state['values']['op'] == t('Update')) {
$chid = db_result(db_query("SELECT chid FROM {ad_channel} WHERE name = '%s' AND chid != %d", $form_state['values']['name'], $form_state['values']['chid']));
}
}
if ($chid) {
form_set_error('name', t('A channel named %name already exists.', array(
'%name' => $form_state['values']['name'],
)));
}
}