- 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";
- #echo '<SQL id="' . intval(local_user()) . '">' . $sql . '</SQL>';
- $r = q(sql, intval(local_user()), intval(local_user()));
- #echo $r;
- foreach ($r as $it) {
- $network_group[] = $it;
+ if($network) {
+ if(intval(feature_enabled(local_user(),'groups'))) {
+ // Find out how unseen network posts are spread across groups
+ $groups_unseen = groups_count_unseen();
+ }
+
+ if(intval(feature_enabled(local_user(),'forumlist_widget'))) {
+ $forums_unseen = forums_count_unseen();