I would like to show (in different color) questions with best reply marked differently than those will no best reply yet. IS that possible? Is there a theme variable available to distinguish?

Comments

ajayg’s picture

Please note I am trying to theme title of node and NOT the comment (best reply color).

taslett’s picture

Status: Active » Closed (won't fix)

No there is not currently a way to target the node title.
You could possibly look at preprocess_node for your theme and look at adding a class to the node.tpl.php if a comment has the bestreply.
Or use jQuery to add a class if a comment has been marked.

I think the jQuery option would be easier, something along these lines.

if ( Drupal.settings.bestreply_ismarked ){
 $('.node h2').addClass('hasbestReply');
}
glennr’s picture

Sorry to reopen this thread, but I'd just like to add my vote for a way to theme nodes with best replies. Or, alternatively, is there a way to create a node.tpl.php variable such as $node->bestreply via template.php?

Thanks for a great module.

ajayg’s picture

Status: Closed (won't fix) » Active

That is what I would like to know. I am trying to distinguish nodes in view before you click on the node and see the full page. So You can either show only answered nodes list or open nodes list. The jquery option will work only if you load the entire page.
Looks like there is an attribute required for the node which need to be set once best answer is chosen.

ajayg’s picture

Category: support » feature
taslett’s picture

@glennr currently best reply keeps track of the comments marked as the bestreply. If you wish to add a variable to the node when it has a bestreply you could use hook_nodeapi.

/**
 * Implementation of hook_nodeapi().
 */
function bestreply_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
   switch ($op) {
     case 'load':
       //check if the node has a bestreply.
      if(bestreply_ismarked($node->nid)){
        return array('has_bestreply' => TRUE);
      }  
     break;
   }  
}  

This will add a variable has_bestreply to the node f it has a bestreply.

taslett’s picture

@ajayg the current dev version 6.x-6.x-dev has basic views support ( needs work ).
I will try and improve that so you can be more selective.

taslett’s picture

Status: Active » Closed (fixed)

New release will be available soon bestreply 6.x-7.1 Closing issue.

glennr’s picture

Thanks for the quick response, taslett. This works perfectly. Will you be including the code in 6.x-7.1?

taslett’s picture

Yes the code is included in 6.x-7.1