- $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
- `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`network`,
- `contact`.`rel`, `contact`.`thumb`, `contact`.`self`,
- `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
- FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
- WHERE `parent-uri` = '%s' AND `uri` != '%s' AND `item`.`deleted` = 0 and `item`.`moderated` = 0
- AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
- AND `item`.`uid` = %d
- $sql_extra
- ORDER BY `parent` DESC, `id` ASC LIMIT %d ,%d ",
- dbesc($link_item['uri']),
- dbesc($link_item['uri']),
- intval($link_item['uid']),
- intval($a->pager['start']),
- intval($a->pager['itemspage'])
-
- );
+ $params = ['order' => ['id'], 'limit' => [$a->pager['start'], $a->pager['itemspage']]];
+ $result = Item::selectForUser($link_item['uid'], [], $condition, $params);
+ $items = Item::inArray($result);