You are here

function _heartbeat_comments_delete_access in Heartbeat 6.4

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

Delete a heartbeat comment checking permissions.

Parameters

$hcid Integer Heartbeat comment ID:

1 string reference to '_heartbeat_comments_delete_access'
heartbeat_comments_menu in modules/heartbeat_comments/heartbeat_comments.module
Implementation of hook_menu().

File

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

Code

function _heartbeat_comments_delete_access($hcid) {

  // users with the administer permission should always be allowed to access our deletion form
  if (user_access('administer heartbeat comments')) {
    return TRUE;
  }
  else {
    global $user;
    $uid = db_result(db_query("SELECT uid FROM {heartbeat_comments} WHERE hcid = %d", $hcid));
    return $uid == $user->uid;
  }

  // TODO: Allow message owner to delete comment as well
}