Added description, removed sorting

This commit is contained in:
Michael 2019-11-07 07:41:54 +00:00
parent 91ad7936f3
commit 806e6a230e
2 changed files with 9 additions and 6 deletions

View file

@ -1541,12 +1541,6 @@ function sort_thr_received_rev(array $a, array $b)
*/
function sort_thr_commented(array $a, array $b)
{
if ($b['pinned'] && !$a['pinned']) {
return 1;
} elseif (!$b['pinned'] && $a['pinned']) {
return -1;
}
return strcmp($b['commented'], $a['commented']);
}

View file

@ -143,6 +143,15 @@ class Item extends BaseObject
return (bool)$useritem['pinned'];
}
/**
* @brief Select pinned rows from the item table for a given user
*
* @param integer $uid User ID
* @param array $selected Array of selected fields, empty for all
*
* @return boolean|object
* @throws \Exception
*/
public static function selectPinned(int $uid, array $selected = [])
{
$useritems = DBA::select('user-item', ['iid'], ['uid' => $uid, 'pinned' => true]);