You are here

function activity_delete_access in Activity 7

Same name and namespace in other branches
  1. 6.2 activity.module \activity_delete_access()
  2. 6 activity.module \activity_delete_access()

Menu Access callback for delete Activity.

Parameters

int $aid: The activity id for the activity

Return value

boolean Whether or not the currently logged in user can delete the specified Activity.

1 call to activity_delete_access()
activity_views_handler_field_activity_link_delete::render in views/views_handler_fields.inc
Render the field.
1 string reference to 'activity_delete_access'
activity_menu in ./activity.module
Implements hook_menu().

File

./activity.module, line 139
Records Activity across the site and surfaces that to Views.

Code

function activity_delete_access($aid) {
  if (user_access('administer activity')) {
    return TRUE;
  }
  if (user_access('delete own activity')) {
    $uid = db_query("SELECT uid FROM {activity} WHERE aid = :aid", array(
      ':aid' => $aid,
    ))
      ->fetchField();
    return $uid == $GLOBALS['user']->uid;
  }
  return FALSE;
}