I was wondering if it's possible to show activity comments with user picture of the activity comment author. I tried to look at the code however
**
* Preprocess the comment display to add in the sanitized variables
*/
function template_preprocess_activity_comments_comment(&$vars, $hook) {
// -- > something here for the display of the activity author's pictures
// like -> $picture = $account->picture;
$vars['username'] = theme('username', $vars['comment']);
$vars['comment_value'] = check_plain($vars['comment']->comment);
$vars['date'] = format_date($vars['comment']->timestamp);
if (activity_comments_delete_access($vars['comment']->cid)) {
$vars['delete_link'] = l(t('Delete'), 'activity/comments/delete/' . $vars['comment']->cid, array('query' => drupal_get_destination()));
}
}
can somebody point me in the right direction in this way please... it will be a great option to have such a feature in this module..
Comments
Comment #1
gausarts commentedThis is what I did to display the picture along side the comments:
Copy the theme from the module into your theme folder. Adjust the imagecache, variables and also put the new variable "user_picture" inside your activity-comment.tpl.php
I had to redeclare the argument in my theme to get it work last time I did, though. Haven't tried to revert back without hook_theme, but that way it worked.
Comment #2
troyl commentedThanks gausarts
for a quick reply,
I tried to add the function to my theme and override the preprocess as you have pointed,
however it doesn't seem to give out any output.
is there anything I am missing..
this is what I put in my theme..
and i added this variable to the activity_comment.tpl.php
print $user_picture;Any help would be great
Comment #3
gausarts commentedPerhaps the file name is the problem. No underscore, it's a hyphen: activity-comment.tpl.php
Comment #4
troyl commentedThanks for the quick reply..
I copied the activity-comment.tpl.php to my theme folder and added the variable
but to no avail..
is there anything else I am missing
Comment #5
gausarts commentedI believe you have cleared the theme registry, so the last step is somehow necessary. You may have to redeclare the template and argument via your hook_theme.
Have you placed something like below into your hook_theme?
I have never done this with other module overrides, but last time I did was a last resort and worked. I believe this should not be necessary, but
So hopefully the maintainers can tell us in the right direction if any other possible step we missed so we can avoid this.
Comment #6
troyl commentedThanks gausart for your reply,
I finally got the pictures working, but directly altering the activity-comment.tpl.php file,
No matter what I do I can't for the life of it got to accept the template suggestion from my theme.
I think the culprit is this code fragment
as explained here http://drupal.org/node/223440
it should not be passed as an array
but i may be wrong, it would be nice for the maintainers of this module to shed some light on this
I really appreciate your help... thanks
Comment #7
gausarts commentedYes, hopefully we can override it like any other modules.
BTW, that hook_theme is an extra step to avoid "directly altering the activity-comment.tpl.php file", unless you can live with that on the following upgrades :)
Comment #8
Scott Reynolds commented@#6 The module isn't providing a template suggestion(s). You are trying to override a theme hook. See here for in-depth instructions plus examples: http://drupal.org/node/341628
There is no error/bug in Activity code.
Comment #9
troyl commented@#8 I never said module had a bug/error however, what eludes me is that every other module is simply overridden by copying and pasting the *.tpl.php file to the theme and making necessary changes to it, however, this is not the case in the activity_comment module.
I even tried to override the hook_theme() function in my theme template file but to no avail. I checked it with devel but no matter what I do it does not get overridden.
If every module can be overridden by a simple process why would activity_module be different. This leaves a question mark on activity_comment module.
Comment #10
AntiNSA commentedsubscribe
Comment #11
zuzu83 commentedan interim solution dans le fichier "activity_comment.tpl.php"
Comment #12
_shyD6 reached its EOL back in February 2016, and there is no active release for D6 for this module anymore.
Development or support is not planned for D6. All D6-related issues are marked as outdated in a bunch.
If the issue remains relevant for D10+ versions, merge requests with proposed solutions for a new module version (D10+) are welcome in a new follow-up issue.
Thanks!