mirror of
https://github.com/friendica/friendica
synced 2025-04-29 03:04:22 +02:00
Display featured posts for contacts
This commit is contained in:
parent
8669f12176
commit
75bc4eccb7
21 changed files with 172 additions and 118 deletions
|
@ -488,39 +488,6 @@ class Post
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Select pinned rows from the post-thread-user table for a given user
|
||||
*
|
||||
* @param integer $uid User ID
|
||||
* @param array $selected Array of selected fields, empty for all
|
||||
* @param array $condition Array of fields for condition
|
||||
* @param array $params Array of several parameters
|
||||
*
|
||||
* @return boolean|object
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function selectPinned(int $uid, array $selected = [], array $condition = [], $params = [])
|
||||
{
|
||||
$postthreaduser = DBA::select('post-thread-user', ['uri-id'], ['uid' => $uid, 'pinned' => true]);
|
||||
if (!DBA::isResult($postthreaduser)) {
|
||||
return $postthreaduser;
|
||||
}
|
||||
|
||||
$pinned = [];
|
||||
while ($useritem = DBA::fetch($postthreaduser)) {
|
||||
$pinned[] = $useritem['uri-id'];
|
||||
}
|
||||
DBA::close($postthreaduser);
|
||||
|
||||
if (empty($pinned)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$condition = DBA::mergeConditions(['uri-id' => $pinned, 'uid' => $uid, 'gravity' => GRAVITY_PARENT], $condition);
|
||||
|
||||
return self::selectForUser($uid, $selected, $condition, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update existing post entries
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue