You are here

function addanother_access in Add Another 6

Same name and namespace in other branches
  1. 7.2 addanother.module \addanother_access()
  2. 7 addanother.module \addanother_access()

Check if we should display the Add another verbage on a node.

1 string reference to 'addanother_access'
addanother_menu in ./addanother.module
Implementation of hook_menu().

File

./addanother.module, line 62
Presents users with an option to create another node of the same type after a node is added.

Code

function addanother_access($nid) {
  $allowed_nodetypes = variable_get('addanother_nodetypes', array());
  $node = node_load($nid);
  if (arg(2) == "edit" && !variable_get('addanother_tab_edit', FALSE)) {
    return FALSE;
  }
  if ($node && variable_get('addanother_tab', FALSE) && isset($allowed_nodetypes[$node->type]) && $allowed_nodetypes[$node->type] && user_access('use add another') && node_access('create', $node->type)) {
    return TRUE;
  }
  return FALSE;
}