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

link|improve this question
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
feedback

2 Answers

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().

link|improve this answer
feedback

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));
  }
}
link|improve this answer
feedback

protected by Community Jan 6 at 11:22

This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site.

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