diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/node.module | 11 | ||||
-rw-r--r-- | modules/node/node.module | 11 |
2 files changed, 14 insertions, 8 deletions
diff --git a/modules/node.module b/modules/node.module index 685509cf3..3c7283b0e 100644 --- a/modules/node.module +++ b/modules/node.module @@ -2167,8 +2167,10 @@ function node_form_alter($form_id, &$form) { * - "view" * - "update" * - "delete" + * - "create" * @param $node - * The node object (or node array) on which the operation is to be performed. + * The node object (or node array) on which the operation is to be performed, + * or node type (e.g. 'forum') for "create" operation. * @param $uid * The user ID on which the operation is to be performed. * @return @@ -2176,8 +2178,9 @@ function node_form_alter($form_id, &$form) { */ function node_access($op, $node = NULL, $uid = NULL) { // Convert the node to an object if necessary: - $node = (object)$node; - + if ($op != 'create') { + $node = (object)$node; + } // If the node is in a restricted format, disallow editing. if ($op == 'update' && !filter_access($node->format)) { return FALSE; @@ -2200,7 +2203,7 @@ function node_access($op, $node = NULL, $uid = NULL) { // If the module did not override the access rights, use those set in the // node_access table. - if ($node->nid && $node->status) { + if ($op != 'create' && $node->nid && $node->status) { $grants = array(); foreach (node_access_grants($op, $uid) as $realm => $gids) { foreach ($gids as $gid) { diff --git a/modules/node/node.module b/modules/node/node.module index 685509cf3..3c7283b0e 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -2167,8 +2167,10 @@ function node_form_alter($form_id, &$form) { * - "view" * - "update" * - "delete" + * - "create" * @param $node - * The node object (or node array) on which the operation is to be performed. + * The node object (or node array) on which the operation is to be performed, + * or node type (e.g. 'forum') for "create" operation. * @param $uid * The user ID on which the operation is to be performed. * @return @@ -2176,8 +2178,9 @@ function node_form_alter($form_id, &$form) { */ function node_access($op, $node = NULL, $uid = NULL) { // Convert the node to an object if necessary: - $node = (object)$node; - + if ($op != 'create') { + $node = (object)$node; + } // If the node is in a restricted format, disallow editing. if ($op == 'update' && !filter_access($node->format)) { return FALSE; @@ -2200,7 +2203,7 @@ function node_access($op, $node = NULL, $uid = NULL) { // If the module did not override the access rights, use those set in the // node_access table. - if ($node->nid && $node->status) { + if ($op != 'create' && $node->nid && $node->status) { $grants = array(); foreach (node_access_grants($op, $uid) as $realm => $gids) { foreach ($gids as $gid) { |