You are here

function availability_can_edit in Availability Calendars 6

A callback function to see if allowed to edit the calendar.

@global object $user

Parameters

int $nid:

Return value

boolean

2 calls to availability_can_edit()
theme_availability_calendars_month in ./availability_calendars.module
Implementation of hook_theme(). produces our calendars on the viewing of an availability_calendars enabled node.
theme_availability_calendars_node in ./availability_calendars.module
Themed output to display a list of node dates.
1 string reference to 'availability_can_edit'
availability_calendars_menu in ./availability_calendars.module
Implementation of hook_menu().

File

./availability_calendars.module, line 52
Availability Calendars Module.

Code

function availability_can_edit($nid = NULL) {
  if ($nid == NULL) {
    return user_access('edit availability calendars') || user_access('edit own availability calendars');
  }
  else {
    $node = node_load($nid);
    global $user;
    return user_access('edit availability calendars') || user_access('edit own availability calendars') && $user->uid == $node->uid;
  }
}