Quantcast
Viewing latest article 13
Browse Latest Browse All 444

Add custom user image field on private messages list instead of default user picture

ok, this is what I have done so far but it is still not working.

First I wanted to add senders profile picture to the private message list on each user profile page. To accomplish that, I used the following code from drupal.org forum:

https://drupal.org/node/1549540#comment-5956560

It does work on my site, but it is using the default user picture. I would like to use a different image for users profile page. So I created an image field named profile_image. I am not pretty sure what is the best approach. On this page, they are trying to change the default user profile picture by the image field but for some reason it is not working for me:

How can I display a picture from a field as the user picture rather than the drupal default with user-picture.tpl.php?

I took the user-picture-tpl.php which had the following code:

<?php if ($user_picture): ?><div class="user-picture"><?php print $user_picture; ?></div><?php endif; ?>

I removed it and add this code:

<?php if (!empty($user->profile_image[LANGUAGE_NONE][0]['fid'])) {  // Load the file  $file = file_load($user->profile_image[LANGUAGE_NONE][0]['fid']);  $account = user_load($account->uid);  // Note the style name is "profile_picture" as explained in your question,  // not "profile_pic" which was in your original code  echo theme('image_style', array('style_name' => 'people_profile_image', 'path' => $file->uri));}

Nothing is working yet. what I am doing wrong? could you please help me?

Thanks


Viewing latest article 13
Browse Latest Browse All 444

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>