Here's the code that I have to add user pictures to comment previews since Drupal core does not add them for some reason.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

Status: Active » Needs review
FileSize
2.62 KB

Here's the patch that abstracts the logic for presets and comments by using hook_comment('view'). This also fixed a possibly destructive change with the last commit by only replaceing the part of $account->content['user_picture'] we care about in hook_profile_alter().

Dave Reid’s picture

One too many comment->picture assignments...

andypost’s picture

Looks good but does not works with panels.. :(

Dave Reid’s picture

Did it work before with panels? :) If it's not using the proper theme functions it's kinda hard to support.

andypost’s picture

When viewing comment you need check theme_get_setting('toggle_comment_user_picture')

Dave Reid’s picture

andypost’s picture

A bit changed logic in preprocess.

I've forget that setup new panels+ctools, so just nedd to restart apache and everything works

Dave Reid’s picture

Status: Needs review » Needs work
+++ imagecache_profiles.module	27 Jul 2010 20:01:40 -0000
@@ -266,12 +262,26 @@ function imagecache_profiles_user($op, &
+  if ($op == 'view' && isset($comment->uid) && theme_get_setting('toggle_comment_user_picture')) {
+    // If this is a comment preview, we need to manually add $comment->picture.
+    if (!isset($comment->picture)) {

We need to remove the check for isset($comment->uid) and move it two lines down as !empty($comment->uid).

Other modules (like Gravatar) may inject something into $comment->picture for anonymous users but still want imagecache to load its style. This would prevent it.

Powered by Dreditor.

andypost’s picture

Dave, please, test my patch with gravatar.

this isset() is required to not continue if $comment->uid broken

suppose only possible problem if gravater's preprocess runs after ICP

andypost’s picture

Status: Needs work » Needs review
FileSize
2.71 KB

Suppose this is a final patch :)

andypost’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Needs review » Patch (to be ported)
andypost’s picture

Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.