"add new sub-task" link is shown to everyone including anonymous visitors. This link should be visible to roles who have "create task" permission.

Here is a rewrite of tasks_link function: simply added && user_access('create task') to the if statement.

function tasks_link($type, $node = NULL, $teaser = FALSE) {
  $links = array();

  if ($type == 'node' && $node->type == 'tasks' && user_access('create task')) {
    if (!$teaser) {
      $links[] = l(t('add new sub-task'), "node/add/tasks",
        array('title' => t('Add a new task to this task list')), "edit[parent]=$node->nid");
    }
  }

  return $links;
} 

Comments

sanduhrs’s picture

Status: Active » Needs review
StatusFileSize
new717 bytes

here is a patch for it.

moonray’s picture

Status: Needs review » Fixed

Fixed in CVS.

Anonymous’s picture

Status: Fixed » Closed (fixed)