From 0cc29af6d0c305efa35fbe3b0c7bc314f21b4166 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 3 Feb 2015 22:55:01 -0800 Subject: order ratings friends first --- mod/ratings.php | 18 +++++++++++++++++- mod/ratingsearch.php | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/ratings.php b/mod/ratings.php index 4b94f0e52..66392fe2b 100644 --- a/mod/ratings.php +++ b/mod/ratings.php @@ -8,6 +8,9 @@ function ratings_init(&$a) { return; } + if(local_channel()) + load_contact_links(local_channel()); + $dirmode = intval(get_config('system','directory_mode')); $x = find_upstream_directory($dirmode); @@ -46,7 +49,20 @@ function ratings_init(&$a) { } $a->poi = $results['target']; - $a->data = $results['ratings']; + + $friends = array(); + $others = array(); + + if($results['ratings']) { + foreach($results['ratings'] as $n) { + if(array_key_exists($n['xchan_hash'],$a->contacts)) + $friends[] = $n; + else + $others[] = $n; + } + } + + $a->data = array_merge($friends,$others); if(! $a->data) { notice( t('No ratings') . EOL); diff --git a/mod/ratingsearch.php b/mod/ratingsearch.php index 9a537bf97..ec2db570b 100644 --- a/mod/ratingsearch.php +++ b/mod/ratingsearch.php @@ -42,7 +42,7 @@ function ratingsearch_init(&$a) { $ret['success'] = true; $r = q("select * from xlink left join xchan on xlink_xchan = xchan_hash - where xlink_link = '%s' and xlink_rating != 0 and xlink_static = 1", + where xlink_link = '%s' and xlink_rating != 0 and xlink_static = 1 order by xchan_name asc", dbesc($p[0]['xchan_hash']) ); -- cgit v1.2.3