function ad_owner_remove_form_submit in Advertisement 6.3
Same name and namespace in other branches
- 6 owners/ad_owners.module \ad_owner_remove_form_submit()
- 6.2 owners/ad_owners.module \ad_owner_remove_form_submit()
- 7 owners/ad_owners.module \ad_owner_remove_form_submit()
Remove the ad owner, and all associated permissions.
File
- owners/
ad_owners.module, line 457 - Enhances the ad module to support ad owners.
Code
function ad_owner_remove_form_submit($form, &$form_state) {
$oid = db_result(db_query('SELECT oid FROM {ad_owners} WHERE aid = %d AND uid = %d', $form_state['values']['aid'], $form_state['values']['uid']));
db_query('DELETE FROM {ad_owners} WHERE oid = %d', $oid);
db_query('DELETE FROM {ad_permissions} WHERE oid = %d', $oid);
$owner = user_load(array(
'uid' => $form_state['values']['uid'],
));
module_invoke_all('adowners', 'remove', $oid, $owner);
drupal_set_message(t('The ad owner %name has been removed.', array(
'%name' => $owner->name,
)));
$form_state['redirect'] = 'node/' . $form_state['values']['aid'] . '/adowners';
}