Avatar in Private Message View

Status: 
Open
Question: 

I've got a social networking site going. Using Advance Profile Kit (APK) and Privatemsg (Private Message) modules. Instead of using the standard picture feature in user profiles, I set up a field (so as to be able to utilize image cache) in Content Types: User Profile. The field name is: field_avatar.

I want to get this avatar to appear in the Private Messages views when someone is reading their messages. This is the code snippet I am tinkering with:

<?php print $author_picture; ?>

I changed the variable: author_picture to: field_avatar thinking that might do the trick. I also tried field_avatar_fid, which I see in the source code of pages that display the avatar.

No luck so far. Am I totally off track?

Any help would be greatly appreciated.

Thanks in advance!

Responses

1. You have to load the correct

You have to load the correct profile node first with nodeprofile_load and only after that, use:

<?php print $node->author_picture; ?>

2. Thanks for the reply. I'm not

Thanks for the reply.

I'm not following. nodeprofile is a drupal 5.x module (I think), but I am using 6.x. I think I am misunderstanding what you are suggesting here.

3. Sorry, I see you are using

Sorry, I see you are using APK, I actually meant to say content_profile_load. But since I am not familiar with APK, I can't help you with this.

4. two options

Don't know if you found the answer here, but I'm doing the same now, so here is what I've found:

1. privatemsg uses theme_user_picture, which in reality is template_preprocess_user_picture (http://api.drupal.org/api/drupal/modules--user--user.module/function/tem...) - you could override that function in your theme to get the picture from content profile (which is used by APK), or.

2. your apporach to replace $author_picture: you would need code like:


<?php
$partcipant = content_profile_load('profile', $message['author']->uid);
print $partcipant->field_profilepicture['0']['filepath'];
?>

'profile' is the name of my content profile, and 'field_profilepicture' is my variant of your 'field_avatar'.

This code would only print the URL to the picture, but you could use that in an img tag, or imagecache preset.