aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2011-12-18 13:03:20 -0800
committerfriendica <info@friendica.com>2011-12-18 13:03:20 -0800
commitdc46a01cd467ac8c03acda6abcdb3aa56ef2db77 (patch)
treed5a711f1bd20925ce2996ec92c9d3b677453ff9b
parenteb05d00794055dcd895ff9c3f73c55d7d7a13d10 (diff)
downloadvolse-hubzilla-dc46a01cd467ac8c03acda6abcdb3aa56ef2db77.tar.gz
volse-hubzilla-dc46a01cd467ac8c03acda6abcdb3aa56ef2db77.tar.bz2
volse-hubzilla-dc46a01cd467ac8c03acda6abcdb3aa56ef2db77.zip
suggest query for no friends messed up
-rw-r--r--include/socgraph.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/include/socgraph.php b/include/socgraph.php
index 78a5514a0..5420b06c8 100644
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -231,20 +231,22 @@ function suggestion_query($uid, $start = 0, $limit = 40) {
intval($limit)
);
- if(count($r))
+ if(count($r) && count($r) >= ($limit -1))
return $r;
- $r = q("SELECT gcontact.* from gcontact
+ $r2 = q("SELECT gcontact.* from gcontact
left join glink on glink.gcid = gcontact.id
- where uid = 0 and cid = 0 and not gcontact.nurl in ( select nurl from contact where uid = %d)
+ where glink.uid = 0 and glink.cid = 0 and not gcontact.nurl in ( select nurl from contact where uid = %d)
and not gcontact.id in ( select gcid from gcign where uid = %d )
- order by rand limit %d, %d ",
+ order by rand() limit %d, %d ",
+ intval($uid),
intval($uid),
intval($start),
intval($limit)
);
- return $r;
+
+ return array_merge($r,$r2);
}