- $r = dba::p("SELECT " . item_fieldlists() . " FROM `thread`
- INNER JOIN `item` ON `item`.`id` = `thread`.`iid` " . item_joins() .
- "WHERE `thread`.`uid` = 0 AND `verb` = ?
- ORDER BY `thread`.`commented` DESC LIMIT " . intval($start) . ", " . intval($itemspage),
- ACTIVITY_POST
- );
- return dba::inArray($r);
+ if (!is_null($accounttype)) {
+ $sql_accounttype = " AND `owner`.`contact-type` = ?";
+ $values = [$accounttype, $start, $itemspage];
+ } else {
+ $sql_accounttype = "";
+ $values = [$start, $itemspage];
+ }
+
+ $r = DBA::p("SELECT `uri` FROM `thread`
+ INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
+ INNER JOIN `contact` AS `author` ON `author`.`id`=`item`.`author-id`
+ INNER JOIN `contact` AS `owner` ON `owner`.`id`=`item`.`owner-id`
+ WHERE `thread`.`uid` = 0 AND NOT `author`.`hidden` AND NOT `author`.`blocked` $sql_accounttype
+ ORDER BY `thread`.`commented` DESC LIMIT ?, ?", $values);
+ return DBA::toArray($r);