You are here

function theme_user_relationships_relationships_block_content in User Relationships 5

Generate the content of a (non-empty) My/User Relationships block

Only called if there are relationships to display

1 theme call to theme_user_relationships_relationships_block_content()
user_relationships_block in ./user_relationships_hooks.inc

File

./user_relationships_theme.inc, line 237

Code

function theme_user_relationships_relationships_block_content($viewing_user, $relationships, $rtid, $all_types) {
  $rows[] = array();
  if ($all_types) {

    // build an array of relationship type names indexed by rtid
    $rtypes = user_relationships_relationship_types_load();
    $relationship_type = array();
    foreach ($rtypes as $rtype) {
      $relationship_type[$rtype->rtid] = $rtype->name;
    }
  }
  foreach ($relationships as $relationship) {
    $relatee_id = $viewing_user->uid == $relationship->requester_id ? $relationship->requestee_id : $relationship->requester_id;
    $relatee = user_load(array(
      'uid' => $relatee_id,
    ));
    if ($all_types) {
      $rows[] = array(
        t('!name', array(
          '!name' => theme('username', $relatee),
        )),
        t('@type', array(
          '@type' => $relationship_type[$relationship->rtid],
        )),
      );
    }
    else {
      $rows[] = array(
        t('!name', array(
          '!name' => theme('username', $relatee),
        )),
      );
    }
  }
  $output = theme('table', array(), $rows);
  return $output;
}