function _node_add_access

cis7 node.module _node_add_access()
cle7 node.module _node_add_access()
elmsmedia7 node.module _node_add_access()
icor7 node.module _node_add_access()
meedjum_blog7 node.module _node_add_access()
mooc7 node.module _node_add_access()

Access callback: Checks whether the user has permission to add a node.

Return value

TRUE if the user has add permission, otherwise FALSE.

See also

node_menu()

1 call to _node_add_access()
node_page_default in modules/node/node.module
Menu callback: Generates a listing of promoted nodes.
6 string references to '_node_add_access'
drupal-6.bare.database.php in modules/simpletest/tests/upgrade/drupal-6.bare.database.php
Bare installation of Drupal 6.17, for test purposes.
drupal-6.filled.database.php in modules/simpletest/tests/upgrade/drupal-6.filled.database.php
Filled installation of Drupal 6.17, for test purposes.
drupal-6.og-ui.database.php in sites/all/modules/ulmus/og/og_ui/tests/drupal-6.og-ui.database.php
Filled installation of Drupal 6.17, for test purposes.
drupal-6.og.database.php in sites/all/modules/ulmus/og/tests/drupal-6.og.database.php
Filled installation of Drupal 6.17, for test purposes.
node_menu in modules/node/node.module
Implements hook_menu().

... See full list

File

modules/node/node.module, line 1963
The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.

Code

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;
}