You are here

function activity_comments_delete_access in Activity 7

Same name and namespace in other branches
  1. 6.2 activity_comments/activity_comments.module \activity_comments_delete_access()

Access callback to determine if you can delete the comment

1 call to activity_comments_delete_access()
template_preprocess_activity_comments_comment in activity_comments/activity_comments.module
Preprocess the comment display to add in the sanitized variables
1 string reference to 'activity_comments_delete_access'
activity_comments_menu in activity_comments/activity_comments.module
Implements hook_menu().

File

activity_comments/activity_comments.module, line 47
Provides comment handling for activity messages

Code

function activity_comments_delete_access($acid) {
  if (user_access('administer activity comments')) {
    return TRUE;
  }

  // quick query to determine if the uid is the same and
  // if the user can delete comments
  if (user_access('activity comments delete own')) {
    $uid = db_query("SELECT uid FROM {activity_comments} WHERE cid = :cid", array(
      ':cid' => $acid,
    ))
      ->fetchField();
    return $uid == $GLOBALS['user']->uid;
  }
  return FALSE;
}