From d6f15f3051fbcfbe92045f07b122175bc681dc5d Mon Sep 17 00:00:00 2001 From: Steven Wittens Date: Mon, 27 Mar 2006 08:08:31 +0000 Subject: - #55666: Comment reply form anchor fixes --- modules/comment.module | 20 ++++++-------------- modules/comment/comment.module | 20 ++++++-------------- 2 files changed, 12 insertions(+), 28 deletions(-) (limited to 'modules') diff --git a/modules/comment.module b/modules/comment.module index 1b6a17217..33448044f 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -204,7 +204,7 @@ function comment_link($type, $node = 0, $main = 0) { else { 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('Add a new comment to this page.')), NULL, 'comment-form'); + $links[] = l(t('add new comment'), "comment/reply/$node->nid", array('title' => t('Add a new comment to this page.')), NULL, 'comment_form'); } else { $links[] = theme('comment_post_forbidden', $node->nid); @@ -220,7 +220,7 @@ function comment_link($type, $node = 0, $main = 0) { if ($node->comment == COMMENT_NODE_READ_WRITE) { if (user_access('post comments')) { 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'); + $links[] = l(t('add new comment'), "comment/reply/$node->nid", array('title' => t('Share your thoughts and opinions related to this posting.')), NULL, 'comment_form'); } } else { @@ -1441,14 +1441,6 @@ function comment_form_submit($form_id, $form_values) { ** overridden by themes. */ -function theme_comment_form($form) { - if (!isset($form['#prefix'])) { - $form['#prefix'] = ''; - } - $form['#prefix'] .= "\n"; - return form_render($form); -} - function theme_comment_preview($comment, $links = array(), $visible = 1) { $output = '
'; $output .= theme('comment_view', $comment, $links, $visible); @@ -1592,17 +1584,17 @@ function theme_comment_post_forbidden($nid) { 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"; + $destination = "destination=". urlencode("comment/reply/$nid#comment_form"); } else { - $destination = "destination=node/$nid"; + $destination = "destination=". urlencode("node/$nid#comment_form"); } if (variable_get('user_register', 1)) { - return t('login or register to post comments', array('%login' => url('user/login', $destination, 'comment-form'), '%register' => url('user/register', $destination, 'comment-form'))); + return t('login or register to post comments', array('%login' => url('user/login', $destination), '%register' => url('user/register', $destination))); } else { - return t('login to post comments', array('%login' => url('user/login', $destination, 'comment-form'))); + return t('login to post comments', array('%login' => url('user/login', $destination))); } } } diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 1b6a17217..33448044f 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -204,7 +204,7 @@ function comment_link($type, $node = 0, $main = 0) { else { 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('Add a new comment to this page.')), NULL, 'comment-form'); + $links[] = l(t('add new comment'), "comment/reply/$node->nid", array('title' => t('Add a new comment to this page.')), NULL, 'comment_form'); } else { $links[] = theme('comment_post_forbidden', $node->nid); @@ -220,7 +220,7 @@ function comment_link($type, $node = 0, $main = 0) { if ($node->comment == COMMENT_NODE_READ_WRITE) { if (user_access('post comments')) { 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'); + $links[] = l(t('add new comment'), "comment/reply/$node->nid", array('title' => t('Share your thoughts and opinions related to this posting.')), NULL, 'comment_form'); } } else { @@ -1441,14 +1441,6 @@ function comment_form_submit($form_id, $form_values) { ** overridden by themes. */ -function theme_comment_form($form) { - if (!isset($form['#prefix'])) { - $form['#prefix'] = ''; - } - $form['#prefix'] .= "\n"; - return form_render($form); -} - function theme_comment_preview($comment, $links = array(), $visible = 1) { $output = '
'; $output .= theme('comment_view', $comment, $links, $visible); @@ -1592,17 +1584,17 @@ function theme_comment_post_forbidden($nid) { 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"; + $destination = "destination=". urlencode("comment/reply/$nid#comment_form"); } else { - $destination = "destination=node/$nid"; + $destination = "destination=". urlencode("node/$nid#comment_form"); } if (variable_get('user_register', 1)) { - return t('login or register to post comments', array('%login' => url('user/login', $destination, 'comment-form'), '%register' => url('user/register', $destination, 'comment-form'))); + return t('login or register to post comments', array('%login' => url('user/login', $destination), '%register' => url('user/register', $destination))); } else { - return t('login to post comments', array('%login' => url('user/login', $destination, 'comment-form'))); + return t('login to post comments', array('%login' => url('user/login', $destination))); } } } -- cgit v1.2.3