function _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.
1 string reference to '_node_add_access'
node_menu in modules/node/node.module
Implements hook_menu().

File

modules/node/node.module, line 1957

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.