- $item = q("SELECT `id`, `mention`, `tag`,`parent`, `title`, `body`, `author-name`, `author-link`, `author-avatar`, `guid`,
- `parent-uri`, `uri`, `contact-id`
- FROM `item` WHERE `id` = %d AND `verb` IN ('%s', '') AND `type` != 'activity' AND
- NOT (`author-link` IN ($profile_list)) LIMIT 1",
- intval($itemid), dbesc(ACTIVITY_POST));
- if (!$item)
- return false;
+ $fields = ['id', 'mention', 'tag', 'parent', 'title', 'body',
+ 'author-link', 'author-name', 'author-avatar', 'author-id',
+ 'guid', 'parent-uri', 'uri', 'contact-id', 'network'];
+ $condition = ['id' => $itemid, 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]];
+ $item = Item::selectFirst($fields, $condition);
+ if (!DBA::isResult($item) || in_array($item['author-id'], $contacts)) {
+ return;
+ }