Hi,
if I try to transform my auction at hook_form_submit(); by
db_query("DELETE FROM `uc_auction` WHERE `nid` = '%s'", $nid);
so that's not possible. I've written a hack with a $_SESSION-var to delete the auction in hook_node_api();
if(isset($_SESSION['check_delete'])){
$form_state['values']['nid'] = $_SESSION['check_delete'];
// delete auction if one exists
$rez = db_query("SELECT `nid` FROM `uc_auction` WHERE `nid` = '%s'", $form_state['values']['nid']);
$res = db_fetch_object($rez);
if(!empty($res->nid)){
db_query("DELETE FROM `uc_auction` WHERE `nid` = '%s'", $res->nid);
} else {
unset($_SESSION['check_delete']);
}
$rez = db_query("SELECT `nid` FROM `uc_auction_bids` WHERE `nid` = '%s'", $form_state['values']['nid']);
$res = db_fetch_object($rez);
if(!empty($res->nid)){
db_query("DELETE FROM `uc_auction_bids` WHERE `nid` = '%s'", $form_state['values']['nid']);
}
$rez = db_query("SELECT `nid` FROM `uc_auction_now` WHERE `nid` = '%s'", $form_state['values']['nid']);
$res = db_fetch_object($rez);
if(!empty($res->nid)){
db_query("DELETE FROM `uc_auction_now` WHERE `nid` = '%s'", $form_state['values']['nid']);
}
}
$_SESSION['check_delete'] is defined in hook_form_submit():
function alter_product_form_submit($form, &$form_state) {
if($form['#post']["is_auction"] == NULL){
$type = array(
'0' => array('field_product_type' => 'Sofortkauf')
);
$_SESSION['check_delete'] = $form_state['values']['nid'];
}
}
it's a hack. but what's the drupal-way for deleting the auction?
Comments
Comment #1
jepster_---- HOPE THAT EDIT DISPLAYS SYNTHAX HIGHLIGHTING (CODE INSIDE
----Hi,
if I try to transform my auction at hook_form_submit(); by
so that's not possible. I've written a hack with a $_SESSION-var to delete the auction in hook_node_api();
$_SESSION['check_delete'] is defined in hook_form_submit():
it's a hack. but what's the drupal-way for deleting the auction?