this is the modified function friends in the file u.module.php
[code]
function friends($url = 0) {
global $client, $apps, $uhome,$ubase, $current_sub_menu, $offset, $num_per_page, $page;
$profile = $this->settabmenu($url, 1,'u');
$current_sub_menu['href'] = 'u/'.$url.'/friends';
// friends
$output = '<ul class="gallery">';
$res = sql_query("SELECT u.* FROM `".tb()."friends` as f left join `".tb()."accounts` as u on u.id=f.fid where f.uid={$profile['id']} ORDER BY f.created DESC LIMIT $offset, $num_per_page");
while ($row = sql_fetch_array($res)) {
$isfriend = 0;
if (($client['id']) && ($client['id'] != $row['id'])) {
$isfriend = sql_counts(sql_query("SELECT * FROM `".tb()."friends` WHERE uid={$row['id']} and fid={$client['id']}"));
}
$on_offline = ((time()-$row['lastlogin']) > 60)? 'offline.gif':'online.gif';
if ($client['id']) {
$res2 = sql_query("select * from `".tb()."friend_reqs` where uid='{$client['id']}' and fid='{$row['id']}'");
$row2 = sql_fetch_array($res2);
if ($row2['uid']) {
$row['is_waiting_friend_confirmation'] = 1;
}
$res2 = sql_query("select * from `".tb()."friend_reqs` where uid='{$row['id']}' and fid='{$client['id']}'");
$row2 = sql_fetch_array($res2);
if ($row2['uid']) {
$row['is_waiting_friend_approval'] = 1;
}
if ($row['id'] != $client['id']) {
$mfs = sql_counts(sql_query("SELECT u.* FROM `".tb()."friends` as f1 inner join `".tb()."friends` as f2 on f1.fid = f2.fid left join `".tb()."accounts` as u on f1.fid=u.id where f1.uid={$row['id']} and f2.uid={$client['id']}"));
$mfslink = "";
if ($mfs > 0) {
if ($mfs == 1) {
$mfslink = url('u/'.$row['username'] .'/mutualfriends',$mfs.t(' friend in common'));
}
else {
$mfslink = url('u/'.$row['username'] .'/mutualfriends',$mfs.t(' friends in common'));
}
}
}
}
$output .= '<li><img src="'.ubase().'/files/icons/'.$on_offline.'"><br/>';
$output .= avatar($row);
$output .= '<div style="word-wrap: break-word;">'.url('u/'.$row['username'], $row['username']).'</div>';
$output .= $mfslink;
if ($row['is_waiting_friend_approval']){
$output .= '<br />'.url('friends/requests',t('+1 Confirm Friend'));
}
elseif ($row['is_waiting_friend_confirmation']){
$output .= '<br />'.t('Friend requested');
}
elseif ((!$isfriend) && ($client['id'] != $row['id']) ) {
$output .= '<br />'.url('friends/add/'.$row['id'],t('+1 Add as Friend'));
}
if ($row['is_waiting_friend_approval']){
$output .= '<br />'.url('friends/requests',t('+1 Confirm Friend'));
}
elseif ($row['is_waiting_friend_confirmation']){
$output .= '<br />'.t('Friend requested');
}
elseif ((!$isfriend) && ($client['id'] != $row['id']) ) {
$output .= '<br />'.url('friends/add/'.$row['id'],t('+1 Add as Friend'));
}
$output .= '</li>';
}
$output .= '</ul>';
// pager
$res = sql_query("select count(*) as total from `".tb()."friends` where uid='{$profile['id']}' ".dbhold() );
$row = sql_fetch_array($res);
$total = $row['total'];
$pb = new PageBar($total, $num_per_page, $page);
$pb->paras = $ubase.'u/'.$profile['username'].'/friends';
$pagebar = $pb->whole_num_bar();
$output .= $pagebar;
section(
array('title'=>'Friends',
'content'=>$output)
);
}
[/code] |