diff options
author | Dries Buytaert <dries@buytaert.net> | 2004-11-15 09:55:28 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2004-11-15 09:55:28 +0000 |
commit | 40f6197c5b74cef722478793fd486a8cb326690a (patch) | |
tree | 1afc3a724aa17c681e4e624435b4b32896733fe6 | |
parent | ef95773b1c6e3b2de1363e607d31f4e8808ec304 (diff) | |
download | brdo-40f6197c5b74cef722478793fd486a8cb326690a.tar.gz brdo-40f6197c5b74cef722478793fd486a8cb326690a.tar.bz2 |
- Patch #11940 by kps: if the user is not allowed to view a newly submitted node, redirect him to the main page.
-rw-r--r-- | modules/node.module | 12 | ||||
-rw-r--r-- | modules/node/node.module | 12 |
2 files changed, 18 insertions, 6 deletions
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 <code>node_comment_statistics</code> table so that the <code>comment_count</code> 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 <code>node_comment_statistics</code> table so that the <code>comment_count</code> 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(); + } } /** diff --git a/modules/node/node.module b/modules/node/node.module index d16b60127..195cba7e8 100644 --- a/modules/node/node.module +++ b/modules/node/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 <code>node_comment_statistics</code> table so that the <code>comment_count</code> 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 <code>node_comment_statistics</code> table so that the <code>comment_count</code> 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(); + } } /** |