You are here

function photos_comment_delete in Album Photos 7.3

Same name and namespace in other branches
  1. 8.4 photos.module \photos_comment_delete()

Implements hook_comment_delete().

File

./photos.module, line 933
Implementation of photos.module.

Code

function photos_comment_delete($comment) {
  $fid = db_select('photos_comment', 'v')
    ->fields('v', array(
    'fid',
  ))
    ->condition('v.cid', $comment->cid)
    ->execute()
    ->fetchField();
  db_delete('photos_comment')
    ->condition('cid', $comment->cid)
    ->execute();

  // Update image comment count.
  db_query("UPDATE {photos_image} SET comcount = (SELECT COUNT(fid) FROM {photos_comment} WHERE fid = :fid) WHERE fid = :fid", array(
    ':fid' => $fid,
  ));
}