summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2006-01-26 08:27:58 +0000
committerDries Buytaert <dries@buytaert.net>2006-01-26 08:27:58 +0000
commit5d43619ca7afa5ba7a876834cb291d7a3a5e9c29 (patch)
tree1892a679442f1347df3505f59127e80a839933f4 /modules
parent548e5d2b5f7ea6c4cd27e626df11ffbc23c1b3d4 (diff)
downloadbrdo-5d43619ca7afa5ba7a876834cb291d7a3a5e9c29.tar.gz
brdo-5d43619ca7afa5ba7a876834cb291d7a3a5e9c29.tar.bz2
- Patch #40752 by moshe/wtanaka: login and regsiter links on each comment don't redirect back to the topic.
Diffstat (limited to 'modules')
-rw-r--r--modules/comment.module26
-rw-r--r--modules/comment/comment.module26
2 files changed, 36 insertions, 16 deletions
diff --git a/modules/comment.module b/modules/comment.module
index a7c8238ef..b72507769 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -206,7 +206,7 @@ function comment_link($type, $node = 0, $main = 0) {
$links[] = l(t('add new comment'), "comment/reply/$node->nid", array('title' => t('Add a new comment to this page.')));
}
else {
- $links[] = theme('comment_post_forbidden');
+ $links[] = theme('comment_post_forbidden', $node->nid);
}
}
}
@@ -216,12 +216,14 @@ function comment_link($type, $node = 0, $main = 0) {
// Node page: add a "post comment" link if the user is allowed to
// post comments, if this node is not read-only, and if the comment form isn't already shown
- if ($node->comment == COMMENT_NODE_READ_WRITE && variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
+ if ($node->comment == COMMENT_NODE_READ_WRITE) {
if (user_access('post comments')) {
- $links[] = l(t('add new comment'), "comment/reply/$node->nid", array('title' => t('Share your thoughts and opinions related to this posting.')), NULL, 'comment');
+ if (variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
+ $links[] = l(t('add new comment'), "comment/reply/$node->nid", array('title' => t('Share your thoughts and opinions related to this posting.')), NULL, 'comment');
+ }
}
else {
- $links[] = theme('comment_post_forbidden');
+ $links[] = theme('comment_post_forbidden', $node->nid);
}
}
}
@@ -697,7 +699,7 @@ function comment_links($comment, $return = 1) {
$links[] = l(t('reply'), "comment/reply/$comment->nid/$comment->cid");
}
else {
- $links[] = theme('comment_post_forbidden');
+ $links[] = theme('comment_post_forbidden', $comment->nid);
}
}
@@ -1598,17 +1600,25 @@ function theme_comment_thread_expanded($comment) {
return $output;
}
-function theme_comment_post_forbidden() {
+function theme_comment_post_forbidden($nid) {
global $user;
if ($user->uid) {
return t("you can't post comments");
}
else {
+ // we cannot use drupal_get_destination() because these links sometimes appear on /node and taxo listing pages
+ if (variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
+ $destination = "destination=comment/reply/$nid";
+ }
+ else {
+ $destination = "node/$nid";
+ }
+
if (variable_get('user_register', 1)) {
- return t('<a href="%login">login</a> or <a href="%register">register</a> to post comments', array('%login' => url('user/login'), '%register' => url('user/register')));
+ return t('<a href="%login">login</a> or <a href="%register">register</a> to post comments', array('%login' => url('user/login', $destination, 'comment-form'), '%register' => url('user/register', $destination, 'comment-form')));
}
else {
- return t('<a href="%login">login</a> to post comments', array('%login' => url('user/login')));
+ return t('<a href="%login">login</a> to post comments', array('%login' => url('user/login', $destination, 'comment-form')));
}
}
}
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index a7c8238ef..b72507769 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -206,7 +206,7 @@ function comment_link($type, $node = 0, $main = 0) {
$links[] = l(t('add new comment'), "comment/reply/$node->nid", array('title' => t('Add a new comment to this page.')));
}
else {
- $links[] = theme('comment_post_forbidden');
+ $links[] = theme('comment_post_forbidden', $node->nid);
}
}
}
@@ -216,12 +216,14 @@ function comment_link($type, $node = 0, $main = 0) {
// Node page: add a "post comment" link if the user is allowed to
// post comments, if this node is not read-only, and if the comment form isn't already shown
- if ($node->comment == COMMENT_NODE_READ_WRITE && variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
+ if ($node->comment == COMMENT_NODE_READ_WRITE) {
if (user_access('post comments')) {
- $links[] = l(t('add new comment'), "comment/reply/$node->nid", array('title' => t('Share your thoughts and opinions related to this posting.')), NULL, 'comment');
+ if (variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
+ $links[] = l(t('add new comment'), "comment/reply/$node->nid", array('title' => t('Share your thoughts and opinions related to this posting.')), NULL, 'comment');
+ }
}
else {
- $links[] = theme('comment_post_forbidden');
+ $links[] = theme('comment_post_forbidden', $node->nid);
}
}
}
@@ -697,7 +699,7 @@ function comment_links($comment, $return = 1) {
$links[] = l(t('reply'), "comment/reply/$comment->nid/$comment->cid");
}
else {
- $links[] = theme('comment_post_forbidden');
+ $links[] = theme('comment_post_forbidden', $comment->nid);
}
}
@@ -1598,17 +1600,25 @@ function theme_comment_thread_expanded($comment) {
return $output;
}
-function theme_comment_post_forbidden() {
+function theme_comment_post_forbidden($nid) {
global $user;
if ($user->uid) {
return t("you can't post comments");
}
else {
+ // we cannot use drupal_get_destination() because these links sometimes appear on /node and taxo listing pages
+ if (variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
+ $destination = "destination=comment/reply/$nid";
+ }
+ else {
+ $destination = "node/$nid";
+ }
+
if (variable_get('user_register', 1)) {
- return t('<a href="%login">login</a> or <a href="%register">register</a> to post comments', array('%login' => url('user/login'), '%register' => url('user/register')));
+ return t('<a href="%login">login</a> or <a href="%register">register</a> to post comments', array('%login' => url('user/login', $destination, 'comment-form'), '%register' => url('user/register', $destination, 'comment-form')));
}
else {
- return t('<a href="%login">login</a> to post comments', array('%login' => url('user/login')));
+ return t('<a href="%login">login</a> to post comments', array('%login' => url('user/login', $destination, 'comment-form')));
}
}
}