summaryrefslogtreecommitdiff
path: root/modules/comment
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2006-03-04 18:01:54 +0000
committerDries Buytaert <dries@buytaert.net>2006-03-04 18:01:54 +0000
commit5de716f100be3c3e1469a0c7a5a6483587d3d435 (patch)
tree2407154a49d9acffe108b60eb0f5b24b9461b3fd /modules/comment
parent189ad85bcdcc75a5543a6894a56728d721b456f5 (diff)
downloadbrdo-5de716f100be3c3e1469a0c7a5a6483587d3d435.tar.gz
brdo-5de716f100be3c3e1469a0c7a5a6483587d3d435.tar.bz2
- Patch #50835 by markus: print message when replying to non-existing comment.
Diffstat (limited to 'modules/comment')
-rw-r--r--modules/comment/comment.module17
1 files changed, 13 insertions, 4 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index aa44503b9..2ba64a06b 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -483,16 +483,22 @@ function comment_reply($nid, $pid = NULL) {
}
else {
drupal_set_message(t('You are not authorized to post comments.'), 'error');
+ drupal_goto("node/$nid");
}
}
else {
// if this is a reply to another comment, show that comment first
// else, we'll just show the user the node they're commenting on.
if ($pid) {
- $comment = db_fetch_object(db_query('SELECT c.*, u.uid, u.name AS registered_name, u.picture, u.data FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = %d AND c.status = %d', $pid, COMMENT_PUBLISHED));
- $comment = drupal_unpack($comment);
- $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
- $output .= theme('comment_view', $comment);
+ if ($comment = db_fetch_object(db_query('SELECT c.*, u.uid, u.name AS registered_name, u.picture, u.data FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = %d AND c.status = %d', $pid, COMMENT_PUBLISHED))) {
+ $comment = drupal_unpack($comment);
+ $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
+ $output .= theme('comment_view', $comment);
+ }
+ else {
+ drupal_set_message(t('The comment you are replying to does not exist.'), 'error');
+ drupal_goto("node/$nid");
+ }
}
else if (user_access('access content')) {
$output .= node_view($node);
@@ -501,17 +507,20 @@ function comment_reply($nid, $pid = NULL) {
// should we show the reply box?
if (node_comment_mode($nid) != COMMENT_NODE_READ_WRITE) {
drupal_set_message(t("This discussion is closed: you can't post new comments."), 'error');
+ drupal_goto("node/$nid");
}
else if (user_access('post comments')) {
$output .= comment_form(array('pid' => $pid, 'nid' => $nid), t('Reply'));
}
else {
drupal_set_message(t('You are not authorized to post comments.'), 'error');
+ drupal_goto("node/$nid");
}
}
}
else {
drupal_set_message(t('You are not authorized to view comments.'), 'error');
+ drupal_goto("node/$nid");
}
return $output;