function ad_owners_add_form_submit in Advertisement 6.2
Same name and namespace in other branches
- 5 ad.module \ad_owners_add_form_submit()
- 6.3 owners/ad_owners.module \ad_owners_add_form_submit()
- 6 owners/ad_owners.module \ad_owners_add_form_submit()
- 7 owners/ad_owners.module \ad_owners_add_form_submit()
File
- owners/
ad_owners.module, line 345 - Enhances the ad module to support ad owners.
Code
function ad_owners_add_form_submit($form, &$form_state) {
$owner = user_load(array(
'name' => $form_state['values']['username'],
));
$node = node_load($form_state['values']['aid']);
if (!ad_owners_add($node, $owner->uid)) {
form_set_error('username', t('The user is already an owner of the ad.'));
}
else {
drupal_set_message(t('The user %username has been added as an owner of this advertisement.', array(
'%username' => $form_state['values']['username'],
)));
drupal_goto('node/' . $form_state['values']['aid'] . '/adowners/' . $owner->uid . '/permissions');
}
}