You are here

function community_tags_delete_broken_tags_form_submit in Community Tags 6.2

Same name and namespace in other branches
  1. 6 community_tags.admin.inc \community_tags_delete_broken_tags_form_submit()
  2. 7 community_tags.admin.inc \community_tags_delete_broken_tags_form_submit()

Submit handler for broken tag deletion form.

File

./community_tags.admin.inc, line 362
community_tags.admin.inc

Code

function community_tags_delete_broken_tags_form_submit($form, &$form_state) {
  db_query('DELETE FROM ct
     USING {community_tags} ct
     LEFT JOIN {term_data} td ON td.tid = ct.tid
     LEFT JOIN {users} u ON u.uid = ct.uid
     LEFT JOIN {node} n ON n.nid = ct.nid
     WHERE td.tid IS NULL
     OR u.uid IS NULL
     OR n.nid IS NULL');
  $deleted = db_affected_rows();
  drupal_set_message(t('@count broken community tags deleted.', array(
    '@count' => $deleted,
  )));
  $form_state['redirect'] = "admin/settings/community-tags";
}