foreach ($parents AS $parent) {
$thread_items = dba::p(item_query()."AND `item`.`parent-uri` = ?
AND `item`.`uid` IN (0, ?) $block_sql
- ORDER BY `item`.`commented` DESC" . $limit,
+ ORDER BY `item`.`uid` ASC, `item`.`commented` DESC" . $limit,
$parent['uri'], local_user());
$comments = dba::inArray($thread_items);
}
}
- $r = dba::p(item_query()."AND `item`.`parent` = (SELECT `parent` FROM `item` WHERE `id` = ?)
- $sql_extra
- ORDER BY `parent` DESC, `gravity` ASC, `id` ASC",
- $item_id
+ $r = dba::p(item_query()."AND `item`.`parent-uri` = (SELECT `parent-uri` FROM `item` WHERE `id` = ?)
+ AND `item`.`uid` IN (0, ?) $sql_extra
+ ORDER BY `item`.`uid` ASC, `parent` DESC, `gravity` ASC, `id` ASC",
+ $item_id, local_user()
);
if (!DBM::is_result($r)) {