You are here

function flag_lists_fl_delete in Flag Lists 7

Same name and namespace in other branches
  1. 6 flag_lists.module \flag_lists_fl_delete()
  2. 7.3 flag_lists.module \flag_lists_fl_delete()

Delete a flag_lists flag.

2 calls to flag_lists_fl_delete()
flag_lists_delete_confirm_submit in ./flag_lists.admin.inc
flag_lists_generate_lists_form_submit in ./flag_lists.admin.inc
Submit handler for flag_lists_generate_lists_form.

File

./flag_lists.module, line 1311
The Flag Lists module.

Code

function flag_lists_fl_delete($flag, $account = NULL) {
  if (!isset($account)) {
    $account = $GLOBALS['user'];
  }
  db_delete('flag_lists_counts')
    ->condition('fid', $flag->fid)
    ->execute();
  db_delete('flag_lists_content')
    ->condition('fid', $flag->fid)
    ->execute();
  db_delete('flag_lists_flags')
    ->condition('fid', $flag->fid)
    ->execute();
  $flag->is_deleted = TRUE;
  module_invoke_all('flag_lists', $flag, $account);
  _flag_lists_clear_cache();
  drupal_set_message(t('The @name @title has been deleted.', array(
    '@name' => variable_get('flag_lists_name', t('list')),
    '@title' => $flag->title,
  )));
}