Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
ajayg CreditAttribution: ajayg commentedPlease note I am trying to theme title of node and NOT the comment (best reply color).
Comment #2
taslett CreditAttribution: taslett commentedNo 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.
Comment #3
glennr CreditAttribution: glennr commentedSorry 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.
Comment #4
ajayg CreditAttribution: ajayg commentedThat 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.
Comment #5
ajayg CreditAttribution: ajayg commentedComment #6
taslett CreditAttribution: taslett commented@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.
This will add a variable has_bestreply to the node f it has a bestreply.
Comment #7
taslett CreditAttribution: taslett commented@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.
Comment #8
taslett CreditAttribution: taslett commentedNew release will be available soon bestreply 6.x-7.1 Closing issue.
Comment #9
glennr CreditAttribution: glennr commentedThanks for the quick response, taslett. This works perfectly. Will you be including the code in 6.x-7.1?
Comment #10
taslett CreditAttribution: taslett commentedYes the code is included in 6.x-7.1