3

How I can change path from /comment/reply/11#comment-form to /node/$node->nid/#comment-form in node $links?

  • What are you actually trying to accomplish here? Do you want the path to get to the comment form to be /node/nid/#comment-form instead of /comment/reply/cid#comment-form? I don't think just changing the path in the link is going to still get you to the comment form. – Chaulky Mar 14 '11 at 2:14
2

In Drupal 7, you can add something like this to your template.php:

function yourtheme_preprocess_comment(&$vars) {
  // Update 'reply' link to make it go to the comment form page anchor instead of some weird comment post page
  if (isset($vars['content']['links']['comment']['#links']['comment-reply'])) {
    $vars['content']['links']['comment']['#links']['comment-reply']['href'] = url('node/' . $vars['node']->nid, array('fragment' => 'comment-form', 'absolute' => TRUE));
  }
}
| improve this answer | |
2

I'm guessing this is a Drupal 6 issue:

The Comment module create the links with hook_links(). You can alter those in a custom module using hook_links_alter().

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.