You are here

function _node_limit_add_access in Node Limit 8

Same name and namespace in other branches
  1. 7 node_limit.module \_node_limit_add_access()

Rewriten access callback for node/add page.

Avoid access to this page when the user does not have the right to add any content type.

1 string reference to '_node_limit_add_access'
node_limit_menu_alter in old/node_limit.module
Implements hook_menu_alter().

File

old/node_limit.module, line 118

Code

function _node_limit_add_access() {
  $types = node_type_get_types();
  foreach ($types as $type) {
    if (node_hook($type->type, 'form') && node_limit_access($type->type)) {
      return TRUE;
    }
  }
  if (user_access('administer content types')) {

    // There are no content types defined that the user has permission to create,
    // but the user does have the permission to administer the content types, so
    // grant them access to the page anyway.
    return TRUE;
  }
  return FALSE;
}