]> git.mxchange.org Git - friendica.git/blobdiff - include/Contact.php
bug #369 - show contacts who are not in any groups
[friendica.git] / include / Contact.php
index 8d893cf70e7b6e0204fb3b0d792b1f82dab80b49..657977801a0d8800e51cc951be6389d850c6d19e 100644 (file)
@@ -176,12 +176,26 @@ function random_profile() {
 }
 
 
-function contacts_not_grouped($uid) {
-       $r = q("select * from contact where uid = %d and self = 0 and id not in (select distinct(`contact-id`) from group_member where uid = %d) ",
+function contacts_not_grouped($uid,$start = 0,$count = 0) {
+dbg(1);
+       if(! $count) {
+               $r = q("select count(*) as total from contact where uid = %d and self = 0 and id not in (select distinct(`contact-id`) from group_member where uid = %d) ",
+                       intval($uid),
+                       intval($uid)
+               );
+dbg(0);
+               return $r;
+
+
+       }
+dbg(1);
+       $r = q("select * from contact where uid = %d and self = 0 and id not in (select distinct(`contact-id`) from group_member where uid = %d) limit %d, %d",
+               intval($uid),
                intval($uid),
-               intval($uid)
+               intval($start),
+               intval($count)
        );
-
+dbg(0);
        return $r;
 }