Hello,

Thanks for this great module! I am closely following the many developments and hope to be able to contribute by testing =)

I was wondering if it is currently possible to have the user's content profile 'field_profile_pic' (using cck imagefield/imagecache) to show to the left of the messages of privatemsg? I believe this would be a great addition and add flavor to the messages page =)

I hope someone will be able to comment/support.

Thank you!

Comments

igorik’s picture

I am not sure how to do that by theme on message list (probably question for module maintainer), but inside message you can do anything, just edit privatemsg-view.tpl.php and replace user picture by user profile image. You can use $content_profile->get_variable() - more info in readme of content profile.
I am sure when the message list will be done by views (someday in the future), the you can show there any image you want using fields in views.

There is one more thing you can do it now, it is completly replace standard drupal user avatar with content profile image. Then there will be needed no changes in privatemsg because there will be shown your content profile image instead drupal avatar.
Watch out, this change will be on whole page.
Add file user-picture.tpl.php into your theme directory (you can copy this file from user module I think)
and inside this file replace code with your own code with something like this (use your own imagecache name and variable)

<?php
$img_url = $content_profile->get_variable('uprofile', 'field_profil_fotografia1');
print l(theme('imagecache', 'ikonka', $img_url), 'user/' . $account->uid );
 ?>

I am using it this way on our site because I don't like limits of drupal avatar and I like the way of imagefield. In this case it is the best remove standard drupal avatar completly from the system (unset from user account), and to give to user an option to insert it in his content profile imagefield - example: http://www.somvprahe.sk/user/matya

berdir’s picture

Version: » 6.x-1.x-dev

igorik imho already answered the question, just a few comments.

I am not sure how to do that by theme on message list (probably question for module maintainer), but inside message you can do anything, just edit privatemsg-view.tpl.php and replace user picture by user profile image. You can use $content_profile->get_variable() - more info in readme of content profile.
I am sure when the message list will be done by views (someday in the future), the you can show there any image you want using fields in views.

Views support won't be available any time soon, our queries are simply way to complicated for Views integration right now. However, we actually use almost the same system as views does use to theme the different columns.

Documentation: http://blog.worldempire.ch/api/group/theming/1

However, from what I understood, trupal218 simply wants to display the image when viewing a specific thread, not on /messages. And you already described the possible ways to do that.

but inside message you can do anything, just ***edit*** privatemsg-view.tpl.php and replace user picture by user profile image.

Do not edit the file in place as it will be overwritten when you update privatemsg.module. Instead, copy it to your theme directory, rebuild the theme registry and then edit it. You probably meant that, but it's not clear from that description.

@trupal218: Please set this to fixed if you have enough information.

Bilmar’s picture

Status: Active » Fixed

Thank you both for the great info!
I will be spending a lot of time this weekend customizing privatemsg - awesome module!

P.S. Sorry for the delayed reply, having on-and-off access to internet this week.

Status: Fixed » Closed (fixed)

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

Heihachi88’s picture

Status: Closed (fixed) » Active

Sorry for reopening this thread, but i can't figure out how to make it work. Tried exactly what igorik said:

Placed user-picture.tpl.php and replaced:

<div class="picture">
<?php print $picture; ?>
</div>

with:

$img_url = $content_profile->get_variable('profile', 'field_photo');
print l(theme('imagecache', 'msg_profile_pic', $img_url), 'user/' . $account->uid );

i'm getting only white screen of death after these actions. What i am doing wrong? (i'm using content_profile module)


However, from what I understood, trupal218 simply wants to display the image when viewing a specific thread, not on /messages. And you already described the possible ways to do that.

And indeed i want to display cck imagefield when viewing a specific thread e.g. http://mysite.kz/messages/view/2

berdir’s picture

WSOD means that you have a syntax error or something like that in your code.

See http://drupal.org/node/158043 on how to display errors.

Heihachi88’s picture

i've added:

error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

to index.php, And still when WSOD happens i dont see any errors!

berdir’s picture

Well, you surely can't simply use a something like "$content_profile->get_variable('profile', 'field_photo');" that needs to come from somewhere.

I guess igorik is getting that from somewhere, I can't help you since I've never used content profile. I suggest you try to ask in IRC, the forums or http://drupal.stackexchange.com.

Heihachi88’s picture

Heihachi88’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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