By iteria on
I want to override the corolla_comment_submitted($comment) function because I need the usernames of some users to be a value from their profile depending on the node type. However, I can't figure out a way to access the node that the comment is connected to. I saw this page (http://api.drupal.org/api/drupal/modules--comment--comment.tpl.php/6) and to me it seems like I should be able to access the $node variable, however that doesn't seem to be the case.
if($node->type == "someType")
{
$name = 'someName';
}
else
{
$name = theme('username', $comment);
}
The code above doesn't seem to function.
Comments
I would try adding this to
I would try adding this to the themes template.info file
The code uses 'author' instead of 'name' because it is a standard variable used in comment.tpl.php (see: http://api.drupal.org/api/drupal/modules--comment--comment.tpl.php/6)
Note you want to replace THEMENAME with the themes actual name.
It didn't work... I couldn't
It didn't work...
I couldn't even get
to work and the name was hardcoded there. I placed the function in template.php. and changed themeName to my actual theme's name, but it didn't work at all. Am I missing something?
Try this
Override the theme_comment_submitted() function by implementing the following function in the template.php file of your theme.
It works! Thank you so much!
It works! Thank you so much!