_node_add_access

Versions
6 – 7
_node_add_access()

▾ 2 functions call _node_add_access()

node_admin_content in modules/node/node.admin.inc
Menu callback: content administration.
node_page_default in modules/node/node.module
Menu callback; Generate a listing of promoted nodes.

Code

modules/node/node.module, line 1737

<?php
function _node_add_access() {
  $types = node_type_get_types();
  foreach ($types as $type) {
    if (node_hook($type->type, 'form') && node_access('create', $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;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.