Firstly, I have to admit that this is fantastic module with three different dismensions to display user icon. It really increase the imagination of the page layout. So thanks to the author.

When using this module, I set default user icon demension as 45x45 and comment user icon demension as 30x30. Every thing is ok in the comment page except that when I preview my comment, user icon in the preview of comment block displays as 45x45(default) not 30x30.

Then after checking the script in imagecache_profiles.module, I found this section:

    // If viewing a comment
    if ($account->cid) {

When a comment is stored in the database it has a cid, but in comment preview page, $account->cid = NULL , but "$account->comment" is always filled.

So I try to change previous section as following:

    // If viewing a comment
    if ($account->comment) {

It’s done.

Another suggestion in profile page. I set profile user icon as 160x160, because I deem it is just for account portrait in the user profile page.

    // If on user profile page
    if (arg(0) == 'user' && is_numeric(arg(1))) {

But the above script make every user icon as 160x160(my default user icon is only 45x45), if I display friend list with friend icon in the profile page, it looks a bit strang.

So I changed into this

    // If on user profile page
    if (arg(0) == 'user' && is_numeric(arg(1)) && isset($account->content)) {

Because in profile page, for instance: I go to user A's profile page, the variable '$account' has '$account->content' when dealing with his portrait.
When I want page to displays A's friend list with user icons, there is no $account->content in the process of dealing with his friends' icons.

CommentFileSizeAuthor
#4 imagecache_profiles-comment-check.patch724 bytesneochief
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

eric.chenchao’s picture

Sorry, I find when in node page, $account of node also has '$account->comment', it is the number of comment belonging to this node.

    // If viewing a comment
    if ($account->cid) {

So I ajust it as

    // If viewing a comment
    if ($account->comment && empty($account->type)) {
eric.chenchao’s picture

A strang thing:

$account->cid = 0;
print isset($account->cid);

The result is TRUE, but

$account->cid = NULL;
print isset($account->cid);

The result is FALSE

johnhanley’s picture

Nothing strange about it: isset

neochief’s picture

Version: 6.x-1.0 » 6.x-1.x-dev
Status: Active » Needs review
FileSize
724 bytes

Solution for broken comment previews. My patch makes addition check, which filters out nodes. Please check the patch.

andypost’s picture

Status: Needs review » Needs work

Commited this fix for preview state.

    // If viewing a comment
-    if ($account->cid) {
+    if (array_key_exists('cid', get_object_vars($account))) { 

For compability reasons (with php 4) property_exists() is not used

But this fix brings nothing because $comment object doesn't have $comment->picture property and default picture should be displayed if defined.

About user profile page - it depends on method used to display profile pictures for other elements... I recommend to use views

andypost’s picture

Status: Needs work » Fixed
eric.chenchao’s picture

Nice job!

Status: Fixed » Closed (fixed)

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