diff --git a/mod/ping.php b/mod/ping.php
index a1648f835..0b5e1c4c9 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -88,20 +88,17 @@ function ping_init(&$a) {
if ( $network )
{
# Find out how unseen network posts are spread across groups
- $sql = "SELECT g.id, g.name, count(i.id) gm
- FROM `group` g, group_member gm, item i
- WHERE g.uid = %d
- AND i.uid = %d
- AND i.unseen AND i.visible
- AND NOT i.deleted
- AND i.`contact-id` = gm.`contact-id`
- AND gm.gid = g.id GROUP BY g.id";
+ $sql = "SELECT g.id, g.name, count(i.id) count " .
+ "FROM `group` g, group_member gm, item i " .
+ "WHERE g.uid = %d " .
+ "AND i.uid = %d " .
+ "AND i.unseen AND i.visible " .
+ "AND NOT i.deleted " .
+ "AND i.`contact-id` = gm.`contact-id` " .
+ "AND gm.gid = g.id GROUP BY g.id";
#echo '' . $sql . '';
- $r = q(sql, intval(local_user()), intval(local_user()));
- #echo $r;
- foreach ($r as $it) {
- $network_group[] = $it;
- }
+ $network_group = q($sql, intval(local_user()), intval(local_user()));
+ #echo '';
}
$intros1 = q("SELECT `intro`.`id`, `intro`.`datetime`,
@@ -223,11 +220,11 @@ function ping_init(&$a) {
$home\r\n";
if ($register!=0) echo "$register";
if ( count($network_group) ) {
- echo '';
+ echo '';
foreach ($network_group as $it) {
echo '' . $it['count'] . "";
}
- echo "";
+ echo "";
}
echo "$all_events