Is there a way to print the user's avatar/profile picture in the default block item template? (user_relationship_locator_default_block_item.tpl.php)

For example, in this issue using the code provided you can print the user avatar in the page.tpl.php and select what image style to use: http://drupal.org/node/980546

Once we have the variable loaded and the image style, then be able to print in the block such as:

<?php

/**
 * @file
 *  Theme for individual block item
 *
 * $requester
 * $requestee
 * $relationship
 */
?>

<li>

<a title='Profile' href="<?php print base_path();?>user/<?php print $requestee->uid ?>">
<?php print $requestee->user_avatar?>
</a>

  <a class="user-link" href="<?php print base_path();?>user/<?php print $requestee->uid ?>"><?php print $requestee->name?></a>
    <div class="relationship-link">
      <?php print theme('user_relationships_request_relationship_direct_link', array('relate_to' => $requestee, 'relationship_type' => $relationship)); ?>
    </div>  
    
</li>

Comments

mrf’s picture

Status: Active » Closed (works as designed)
<li>
  <?php print theme('user_picture', array('account' => $requestee)); ?>
  <a class="user-link" href="<?php print base_path();?>user/<?php print $requestee->uid ?>"><?php print $requestee->name?></a>
    <div class="relationship-link">
      <?php print theme('user_relationships_request_relationship_direct_link', array('relate_to' => $requestee, 'relationship_type' => $relationship)); ?>
    </div>
</li>

The above example worked for me. This template file is simple by design, leaving these type of modifications up to the themer / site developer.

broncomania’s picture

With imagecache you can use this.

  <a class="user-link" href="<?php print base_path();?>user/<?php print $requestee->uid ?>"><?php print theme('image_style', array('style_name' => 'YOUR-IMAGECACHE-STYLE-HERE', 'path' => !empty($requestee->picture->uri) ? $requestee->picture->uri : str_replace('/sites/default/files/','public://',variable_get('user_picture_default', '')), 'title' => $requestee->name, 'alt' => $requestee->name)); ?></a>
mrf’s picture

Component: Miscellaneous » Documentation
Category: feature » task
Status: Closed (works as designed) » Active

Reminder to set up a docs page about this ... eventually.

mrf’s picture

Issue summary: View changes

Added link to issue