How to display user picture programmatically in a rule (User Relationships) Starting from the code in a previous question, I am now trying to post a user picture in a rule that displays a relationship between two users (User Relationships module.)

It is the requestees's picture I am trying to display (the $requestee variable is allowed)

Here is the code I have so far:

$imgpath = file_load(($requestee-&gt;picture[und][0]['uid']))-&gt;uri;
$image = theme('image_style', array('path' =&gt; $imgpath, 'style_name' =&gt; 'thumbnail', 'attributes' =&gt; array('class' =&gt; array('RequesteesPicture'))));
$link = l($image, "user/$requestee-&gt;uid", array('html' =&gt; TRUE));
print $link;


I see the placeholder for the pic. The link to the requestee's picture is correct and the image style is also correct. But the pic does not show.

What do I need to do to make the pic show up?

Thanks. :)
Try something like this, just for grins. Make sure you're actually returning the URI, and maybe provide an alternative image if they don't have one for themselves. Also, your link might be messed up.

I'm not entirely sure how you're getting that URI for the profile image.

$imgpath = $requestee-&gt;picture[und][0]['uid']-&gt;uri; // Maybe? I would think the URI is in the picture array.
$vars = array(
  'style_name' =&gt; 'thumbnail',
  'path' =&gt; $imgpath,
  'attributes' =&gt; array(
    'class' =&gt; array('RequesteesPicture'),
  ),
);
$image = theme_image_style($vars);
$link = l($image, "user/" . $requestee-&gt;uid, array('html' =&gt; TRUE));
print $link;