You are here

function _heartbeat_comments_delete in Heartbeat 6.4

Same name and namespace in other branches
  1. 7 modules/heartbeat_comments/heartbeat_comments.module \_heartbeat_comments_delete()

Deletes a heartbeat comment.

2 calls to _heartbeat_comments_delete()
heartbeat_comments_delete_confirm_submit in modules/heartbeat_comments/heartbeat_comments.module
Submit callback te delete a heartbeat comment.
heartbeat_comments_multiple_delete_confirm_submit in modules/heartbeat_comments/heartbeat_comments.admin.inc
Process comment_multiple_delete_confirm form submissions.

File

modules/heartbeat_comments/heartbeat_comments.module, line 896
heartbeat_comments.module Heartbeat comments can come with two possible

Code

function _heartbeat_comments_delete($hcid) {
  $lang_uaid = db_result(db_query("SELECT uaid FROM {heartbeat_comments} WHERE hcid = %d", $hcid));
  $uaids = heartbeat_get_uaids($lang_uaid);
  db_query("DELETE FROM {heartbeat_comments} WHERE hcid = %d", $hcid);
  db_query("UPDATE {heartbeat_activity} SET uaid_comments = uaid_comments - 1 WHERE uaid IN ( %s ) ", implode(',', $uaids));
  if (variable_get('heartbeat_comments_cache', 1)) {
    cache_clear_all('heartbeat:comments:' . $lang_uaid . ':0', 'cache');
  }
}