how to add a user picture in version 7.x in user_relationships-pending_block.tpl.php

in 6x version

<?php
// $Id: user_relationships-pending_block.tpl.php,v 1.1.2.12 2010/01/03 19:19:11 alexk Exp $
/**
 * @file
 * Template for relationships requests block
 * List all pending requests and provide links to the actions that can be taken on those requests
 */
if ($relationships) {
 
$list = array();
  foreach (
$relationships as $rtid => $relationship) {
   
$tt_rel_name = ur_tt("user_relationships:rtid:$rtid:name", $relationship->name);
   
$tt_rel_plural_name = ur_tt("user_relationships:rtid:$rtid:plural_name", $relationship->plural_name);
    if (
$user->uid == $relationship->requester_id) {
     
$relation_to =& $relationship->requestee;
     
$usr = user_load($relationship->requestee_id);
     
$picture = theme('imagecache', 'minithumb_pict', ($usr->picture) ? $usr->picture : variable_get('user_picture_default', ''), strip_tags(theme('username', $relation_to)));
     
$controls = theme('user_relationships_pending_request_cancel_link', $user->uid, $relationship->rid);
     
$line = t('@rel_name to !username (!controls)', array('@rel_name' => $tt_rel_name, '!username' => theme('username', $relation_to), '!controls' => $controls));
     
$key = t('Sent requests');
    }
    else {
     
$relation_to =& $relationship->requester;
     
$usr = user_load($relationship->requester_id);
     
$picture = theme('imagecache', 'minithumb_pict', ($usr->picture) ? $usr->picture : variable_get('user_picture_default', ''), strip_tags(theme('username', $relation_to)));
     
$controls =
       
theme('user_relationships_pending_request_approve_link', $user->uid, $relationship->rid).'|'.
       
theme('user_relationships_pending_request_disapprove_link', $user->uid, $relationship->rid);
     
$line = t('@rel_name from !username (!controls)', array('@rel_name' => $tt_rel_name, '!username' => theme('username', $relation_to), '!controls' => $controls));
     
$key = t('Received requests');
    }
   
$list[$key][] = $picture . $line;
  }

 

$output = array();
  foreach (
$list as $title => $users) {
   
$output[] = theme('item_list', $users, $title);
  }
}

drupal_add_css(drupal_get_path('theme', 'lds_theme') .'/css/modifs/user_relationships-pending_block.css', 'theme');

print isset(

$output) ? implode('', $output) : t('No Pending Requests');

?>
Files: 
CommentFileSizeAuthor
#4 Selection_034.jpeg120.47 KBmrf

Comments

BenK’s picture

Subscribing

D2ev’s picture

you can use this

<?php
/**
 * @file
 * Template for relationships requests block
 * List all pending requests and provide links to the actions that can be taken on those requests
 */
if ($relationships) {
 
$list = array();
  foreach (
$relationships as $rtid => $relationship) {
   
$tt_rel_name = ur_tt("user_relationships:rtid:$rtid:name", $relationship->name);
   
$tt_rel_plural_name = ur_tt("user_relationships:rtid:$rtid:plural_name", $relationship->plural_name);
    if (
$user->uid == $relationship->requester_id) {
     
$relation_to =& $relationship->requestee;
     
$usr = user_load($relationship->requestee_id);
     
$picture = theme('image_style', array('style_name' => 'thumbnail', 'path' => !empty($usr->picture->uri) ? $usr->picture->uri : str_replace('/sites/default/files/','public://',variable_get('user_picture_default', ''))));  
     
$controls = theme('user_relationships_pending_request_cancel_link', array('uid' => $account->uid, 'rid' => $relationship->rid));
     
$line = t('@rel_name to !picture !username (!controls)', array('@rel_name' => $tt_rel_name, '!picture' => $picture, '!username' => theme('username', array('account' => $relation_to)), '!controls' => $controls));
     
$key = t('Sent requests');
    }
    else {
     
$relation_to =& $relationship->requester;
     
$usr = user_load($relationship->requester_id);
     
$picture = theme('image_style', array('style_name' => 'thumbnail', 'path' => !empty($usr->picture->uri) ? $usr->picture->uri : str_replace('/sites/default/files/','public://',variable_get('user_picture_default', ''))));
     
$controls =
       
theme('user_relationships_pending_request_approve_link', array('uid' => $account->uid, 'rid' => $relationship->rid)).'|'.
       
theme('user_relationships_pending_request_disapprove_link', array('uid' => $account->uid, 'rid' => $relationship->rid));
     
$line = t('@rel_name from !picture !username (!controls)', array('@rel_name' => $tt_rel_name, '!picture' => $picture, '!username' => theme('username', array('account' => $relation_to)), '!controls' => $controls));
     
$key = t('Received requests');
    }
   
$list[$key][] = $line;
  }

 
$output = array();
  foreach (
$list as $title => $users) {
   
$output[] = theme('item_list', array('items' => $users, 'title' => $title));
  }
}

print isset(
$output) ? implode('', $output) : t('No Pending Requests');
?>
RKS’s picture

This may or may not have helped Charlie, but it did for me. So thanks for that.

What about on the normal user relationships page? Is that covered somewhere?

mrf’s picture

Component:User interface» Documentation
Category:support» task
Issue tags:+Novice
StatusFileSize
new120.47 KB

RKS for a normal relationships page there is a setting in the admin form.

UR Admin form screenshot

Anyone up for creating a documentation page for this?

Kline’s picture

How would we change the user pictures to use a custom image field/style instead of the drupal default?

broncomania’s picture

The imagecache integration is really bad. Here has some work tobe done. It's also missing in the pending requests block. So the easiest way is to code yourself what you need.