Altering Nodecomment $links I am trying to alter the "reply" links added to Nodecomment comments when the nodes are listed beneath the topic. The problem I have is that I want users to be restricted to the inline submit form, but Nodecomment is adding links to the standalone reply page. 

While trying to ovveride the links using hook_link_alter(), I ran into an issue with Nodecomment comments are treated much like regular comments in that hook_link_alter() doesn't seem to be run on them. Here is an example:

/**
* Alter module links. 
*
*/
function mymodule_link_alter(&amp;$links, $node) {

    // This is an example of altering links that works as expected
    if (isset($links['comment_add']) &amp;&amp; node_access('create', $node)) {
      $links['comment_reply'] = array(
        'title' =&gt; t('reply'),
        'title' =&gt; t('Link altered'),
        'href' =&gt; 'http://example.com',
      );
    }

    // This is an example of altering nodecomment links failing.
    // When rendering a list of topic replies, the comment_reply link
    // will not be altered.
    if (isset($links['comment_reply']) &amp;&amp; node_access('create', $node)) {
      $links['comment_reply'] = array(
        'title' =&gt; t('reply'),
        'title' =&gt; t('Link altered'),
        'href' =&gt; 'http://example.com',
      );
    }
}


I am looking for solutions which can (ideally) be packaged in the site's custom module rather than theme.
Reading the documentation for hook_link_alter() I find the following sentence.


  Perform alterations before links on a node or comment are rendered.


The hook implementation you are using is missing the last argument: the definition of the hook given by the documentation is hook_link_alter(&amp;$links, $node, $comment = NULL). 

Looking at the code of comment_render(), which is the function that renders all the comments of a node, you can notice that hook_link_alter() is invoked right after the data is loaded from the database (and after hook_link(), of course).

if ($comment = db_fetch_object($result)) {
  $comment-&gt;name = $comment-&gt;uid ? $comment-&gt;registered_name : $comment-&gt;name;
  $links = module_invoke_all('link', 'comment', $comment, 1);
  drupal_alter('link', $links, $node, $comment);

  $output .= theme('comment_view', $comment, $node, $links);
} 


hook_comment is invoked from theme_comment_view().

if ($visible) {
  $comment-&gt;comment = check_markup($comment-&gt;comment, $comment-&gt;format, FALSE);

  // Comment API hook
  comment_invoke_comment($comment, 'view');

  $output .= theme('comment', $comment, $node, $links);
}
else {
  $output .= theme('comment_folded', $comment);
}


hook_comment(), which is invoked with a call to comment_invoke_comment(), is not called for comments that are not visible.

The implementation of hook_link_alter() you created should at least check which comments it is altering, if it is supposed to alter only specific comments. At least, it should check the last parameter ($comment) is not NULL; if that happens, the hook is invoked to alter node links, which is not what you want as you need to alter comment links.