You are here

function activity_comments_delete_access in Activity 6.2

Same name and namespace in other branches
  1. 7 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
Implementation of hook_menu().

File

activity_comments/activity_comments.module, line 46
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_result(db_query("SELECT uid FROM {activity_comments} WHERE cid = %d", $acid));
    return $uid == $GLOBALS['user']->uid;
  }
  return FALSE;
}