I would like "Add a comment" to be replaced by "Reply" in forum nodes. I can't use Localization to replace the string because "Reply" doesn't go well with other nodes I allow comments for. For those, "Add a comment" is fine.

So I was thinking of manually building links to replace those in the $links variable, which in itself isn't so tough.

I need:

1. Reply
2. Reply with quote (using Quote module)
3. "XXX reads" counter (I have the php for this)
4. "Log in or register to reply" to show to logged out users. (instead of 1 and 2)

Is there anything I'm forgetting or is there a more sane way of going about this?

Comments

masande’s picture

don't forget about adding / modifying phptemplate variables. $links in nodes are passed as an array but can be easily modified if you know the key. each template type (page, node, comment, etc.) has its own set of variables so it may take a little searching around phptemplate.engine to find the correct one to modify in your case.

for my comment template, i have the following _phptemplate_variables function to change the date format, the commenter name format and the presentation and permissions of the edit/delete links:

function  _phptemplate_variables($hook, $vars) {
   switch($hook) {
     case 'comment' :
        $date = $vars['comment']->timestamp;
        $comment = $vars['comment'];
        $access = user_access('administer comments');
        $vars['date'] = format_date($date, 'custom', 'j M Y').' at '.format_date($date, 'custom', 'g:iA');
        $vars['fullname'] = theme('commentername', $comment);
        if ($access) {
          $vars['links'] = '<ul><li><a href="'.base_path().'comment/edit/'.$comment->cid.'">edit this comment</a></li><li><a href="'.base_path().'comment/delete/'.$comment->cid.'">delete this comment</a></li></ul>';
        } else {
          $vars['links'] = NULL;
        }
        break;
   }
   return $vars;
}

hopefully this will give you an alternate path to follow to find the best solution.

best of luck on your drupal project.

Mark Sanders
Q Collective

Mark Sanders
Q Collective