diff --git a/assets/less/classes/forum/post.less b/assets/less/classes/forum/post.less index ee8274a3..382c5028 100644 --- a/assets/less/classes/forum/post.less +++ b/assets/less/classes/forum/post.less @@ -225,4 +225,39 @@ vertical-align: middle; } } + + &__badge { + background-color: var(--accent-colour); + border-radius: 12px; + width: 100%; + padding: 2px; + box-shadow: 0 2px 3px #000A; + margin: 4px; + overflow: hidden; + + @media (max-width: @site-mobile-width) { + width: auto; + padding: 2px 10px; + margin: 0; + align-self: flex-start; + margin-left: 5px; + font-size: .9em; + } + + &__desktop { + display: block; + + @media (max-width: @site-mobile-width) { + display: none; + } + } + + &__mobile { + display: none; + + @media (max-width: @site-mobile-width) { + display: block; + } + } + } } diff --git a/src/Forum/post.php b/src/Forum/post.php index 2c15be46..03cffff0 100644 --- a/src/Forum/post.php +++ b/src/Forum/post.php @@ -106,7 +106,14 @@ function forum_post_get(int $postId, bool $allowDeleted = false): array SELECT MIN(`post_id`) = p.`post_id` FROM `msz_forum_posts` WHERE `topic_id` = p.`topic_id` - ) AS `is_opening_post` + ) AS `is_opening_post`, + ( + SELECT `user_id` = u.`user_id` + FROM `msz_forum_posts` + WHERE `topic_id` = p.`topic_id` + ORDER BY `post_id` + LIMIT 1 + ) AS `is_original_poster` FROM `msz_forum_posts` AS p LEFT JOIN `msz_users` AS u ON u.`user_id` = p.`user_id` @@ -146,7 +153,14 @@ function forum_post_listing(int $topicId, int $offset = 0, int $take = 0, bool $ SELECT MIN(`post_id`) = p.`post_id` FROM `msz_forum_posts` WHERE `topic_id` = p.`topic_id` - ) AS `is_opening_post` + ) AS `is_opening_post`, + ( + SELECT `user_id` = u.`user_id` + FROM `msz_forum_posts` + WHERE `topic_id` = p.`topic_id` + ORDER BY `post_id` + LIMIT 1 + ) AS `is_original_poster` FROM `msz_forum_posts` AS p LEFT JOIN `msz_users` AS u ON u.`user_id` = p.`user_id` diff --git a/templates/forum/macros.twig b/templates/forum/macros.twig index 2dac600a..b28813ba 100644 --- a/templates/forum/macros.twig +++ b/templates/forum/macros.twig @@ -393,13 +393,23 @@ {{ post.poster_name }} - {{ post.poster_title }} + + {% if post.poster_title|length > 0 %} +