Added priority fetch function.
This commit is contained in:
parent
ccb1005418
commit
a9e2458ac5
2 changed files with 20 additions and 0 deletions
|
@ -43,6 +43,10 @@ if (!empty($topic['poll_id'])) {
|
|||
$pollUserAnswers = forum_poll_get_user_answers($topic['poll_id'], $topicUserId);
|
||||
}
|
||||
|
||||
if (forum_has_priority_voting($topic['forum_type'])) {
|
||||
$topicPriority = forum_topic_priority($topic['topic_id']);
|
||||
}
|
||||
|
||||
$topicIsLocked = !empty($topic['topic_locked']);
|
||||
$topicIsArchived = !empty($topic['topic_archived']);
|
||||
$topicPostsTotal = (int)($topic['topic_count_posts'] + $topic['topic_count_posts_deleted']);
|
||||
|
|
|
@ -666,3 +666,19 @@ function forum_topic_nuke(int $topicId): bool
|
|||
$nukeTopic->bindValue('topic', $topicId);
|
||||
return $nukeTopic->execute();
|
||||
}
|
||||
|
||||
function forum_topic_priority(int $topic): array
|
||||
{
|
||||
if($topic < 1) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$getPriority = db_prepare('
|
||||
SELECT tp.`topic_id`, tp.`topic_priority`
|
||||
FROM `msz_forum_topics_priority` AS tp
|
||||
LEFT JOIN `msz_users` AS u
|
||||
ON u.`user_id` = tp.`user_id`
|
||||
');
|
||||
|
||||
return db_fetch_all($getPriority);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue