You are here

function trigger_unassign_submit in Drupal 6

Same name and namespace in other branches
  1. 7 modules/trigger/trigger.admin.inc \trigger_unassign_submit()

File

modules/trigger/trigger.admin.inc, line 80
Admin page callbacks for the trigger module.

Code

function trigger_unassign_submit($form, &$form_state) {
  $form_values = $form_state['values'];
  if ($form_values['confirm'] == 1) {
    $aid = actions_function_lookup($form_values['aid']);
    db_query("DELETE FROM {trigger_assignments} WHERE hook = '%s' AND op = '%s' AND aid = '%s'", $form_values['hook'], $form_values['operation'], $aid);
    $actions = actions_get_all_actions();
    watchdog('actions', 'Action %action has been unassigned.', array(
      '%action' => $actions[$aid]['description'],
    ));
    drupal_set_message(t('Action %action has been unassigned.', array(
      '%action' => $actions[$aid]['description'],
    )));
    $hook = $form_values['hook'] == 'nodeapi' ? 'node' : $form_values['hook'];
    $form_state['redirect'] = 'admin/build/trigger/' . $hook;
  }
  else {
    drupal_goto('admin/build/trigger');
  }
}