From 40f6197c5b74cef722478793fd486a8cb326690a Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 15 Nov 2004 09:55:28 +0000 Subject: - Patch #11940 by kps: if the user is not allowed to view a newly submitted node, redirect him to the main page. --- modules/node.module | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'modules/node.module') diff --git a/modules/node.module b/modules/node.module index d16b60127..195cba7e8 100644 --- a/modules/node.module +++ b/modules/node.module @@ -75,7 +75,7 @@ function node_help_page() { * Gather a listing of links to nodes. * * @param $result - * A DB result object from a query to fetch node objects. If your query joins the node_comment_statistics table so that the comment_count field is available, a title attribute will be added to show the number of comments. + * A DB result object from a query to fetch node objects. If your query joins the node_comment_statistics table so that the comment_count field is available, a title attribute will be added to show the number of comments. * field to be set. * @param $title * A heading for the resulting list. @@ -1384,9 +1384,15 @@ function node_submit($node) { } } - // Node was submitted successfully. Redirect to the viewing page. drupal_set_message($msg); - drupal_goto('node/'. $node->nid); + + // Node was submitted successfully: redirect the user. + if (node_access('view', $node)) { + drupal_goto('node/'. $node->nid); + } + else { + drupal_goto(); + } } /** -- cgit v1.2.3