mirror of
https://github.com/friendica/friendica
synced 2025-04-25 19:10:11 +00:00
count unread forum items for forumlist widget (ping.php)
This commit is contained in:
parent
1babf5a6d1
commit
ddf3589fc5
11 changed files with 208 additions and 68 deletions
|
@ -87,6 +87,7 @@ function widget_forumlist($a) {
|
|||
'url' => $a->get_baseurl() . '/network?f=&cid=' . $contact['id'],
|
||||
'external_url' => $a->get_baseurl() . '/redir/' . $contact['id'],
|
||||
'name' => $contact['name'],
|
||||
'cid' => $contact['id'],
|
||||
'micro' => proxy_url($contact['micro'], false, PROXY_SIZE_MICRO),
|
||||
'id' => ++$id,
|
||||
);
|
||||
|
@ -147,3 +148,30 @@ function forumlist_profile_advanced($uid) {
|
|||
$o .= $forumlist;
|
||||
return $o;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief count unread forum items
|
||||
*
|
||||
* Count unread items of connected forums and private groups
|
||||
*
|
||||
* @return array
|
||||
* id = contact id
|
||||
* name = contact name
|
||||
* count = counted unseen items
|
||||
*
|
||||
*/
|
||||
|
||||
function forums_count_unseen() {
|
||||
$r = q("SELECT `contact`.`id`, `contact`.`name`, COUNT(`item`.`unseen`) AS `count` FROM `item`
|
||||
INNER JOIN `contact` ON `item`.`contact-id` = `contact`.`id`
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` AND NOT `item`.`deleted`
|
||||
AND `contact`.`network`= 'dfrn' AND (`contact`.`forum` OR `contact`.`prv`)
|
||||
AND NOT `contact`.`blocked` AND NOT `contact`.`hidden`
|
||||
AND NOT `contact`.`pending` AND NOT `contact`.`archive`
|
||||
AND `contact`.`success_update` > `failure_update`
|
||||
GROUP BY `contact`.`id` ",
|
||||
intval(local_user())
|
||||
);
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue