Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions acp/recenttopics_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ public function main($id, $mode)
$rt_min_topic_level = $request->variable('rt_min_topic_level', 0);
$config->set('rt_min_topic_level', $rt_min_topic_level);

// Show announcements first
$config->set('rt_announcements_first', $request->variable('rt_announcements_first', 0) ? 1 : 0);

// variable should be '' as it is a string ("1, 2, 3928") here, not an integer.
$rt_anti_topics = $request->variable('rt_anti_topics', '');
$ants = explode(',', $rt_anti_topics);
Expand Down Expand Up @@ -297,6 +300,7 @@ public function main($id, $mode)
'RT_ADS_CODE' => $config_text->get('rt_ads_code'),
'RT_SHOW_LIKES' => (int) $config['rt_show_likes'],
'RT_SIDE_SHOW_DATE' => (int) $config['rt_side_show_date'],
'RT_ANNOUNCEMENTS_FIRST' => (int) $config['rt_announcements_first'],
'S_POSTLOVE' => $phpbb_container->has('avathar.postlove.topic_likes'),
// Bundled copy, so the ACP page makes no request to Patreon's CDN (issue #200)
'U_PATREON_BUTTON' => $phpbb_root_path . 'ext/avathar/recenttopics/adm/style/images/become_a_patron_button.png',
Expand Down
5 changes: 5 additions & 0 deletions adm/style/acp_recenttopics.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ <h1>{{ lang('RECENT_TOPICS') }}</h1>
</dd>
</dl>

<dl>
<dt><label for="rt_announcements_first">{{ lang('RT_ANNOUNCEMENTS_FIRST') }}</label><br /><span>{{ lang('RT_ANNOUNCEMENTS_FIRST_EXP') }}</span></dt>
<dd><input type="checkbox" name="rt_announcements_first" id="rt_announcements_first" value="1"{% if RT_ANNOUNCEMENTS_FIRST %} checked="checked"{% endif %} /></dd>
</dl>

<dl>
<dt><label for="rt_anti_topics">{{ lang('RT_ANTI_TOPICS') }}{{ lang('COLON') }}</label><br /><span>{{ lang('RT_ANTI_TOPICS_EXP') }}</span></dt>
<dd><input type="text" id="rt_anti_topics" name="rt_anti_topics" size="30" value="{{ RT_ANTI_TOPICS }}" /></dd>
Expand Down
33 changes: 33 additions & 0 deletions core/recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,33 @@ private function show_likes(): bool
return $this->topic_likes_service !== null && !empty($this->config['rt_show_likes']);
}

/**
* Put a page's announcements and global announcements ahead of its other topics.
*
* Only the rows already on this page move, so old announcements never come back into the
* list. Both groups keep their existing (time) order; stickies stay with the normal topics.
*
* @param array $rowset Topic rows for the current page, as returned by get_topics_sql()
* @return array The same rows, announcements first
*/
private function announcements_first(array $rowset): array
{
$announcements = $others = [];
foreach ($rowset as $row)
{
if (in_array((int) $row['topic_type'], [POST_ANNOUNCE, POST_GLOBAL], true))
{
$announcements[] = $row;
}
else
{
$others[] = $row;
}
}

return array_merge($announcements, $others);
}

/**
* Narrow the board's forums down to the ones this list may draw topics from.
*
Expand Down Expand Up @@ -786,6 +813,12 @@ private function fill_template($tpl_loopname, $topic_tracking_info, int $topics_
$rowset = $this->get_topics_sql();
$topic_icons = array();

// Move this page's announcements and global announcements to its top (issue #201)
if (!empty($this->config['rt_announcements_first']))
{
$rowset = $this->announcements_first($rowset);
}

// Get postlove like counts if installed and switched on in the ACP
$topic_likes = [];
if ($this->show_likes() && !empty($this->topic_list))
Expand Down
2 changes: 2 additions & 0 deletions language/ar/info_acp_recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
'RT_PAGE_NUMBERMAX_EXP' => 'تحديد الحد الأقصى لعدد الصفحات التي تريد عرضها . هذا الخيار لا يعمل في حالة تحديد الخيار السابق ( عرض جميع الصفحات ).',
'RT_MIN_TOPIC_LEVEL' => 'نوع المواضيع ',
'RT_MIN_TOPIC_LEVEL_EXP' => 'تحديد نوع المواضيع التي تريد عرضها. سيتم العرض من الأقل إلى الأكثر.',
'RT_ANNOUNCEMENTS_FIRST' => 'عرض الإعلانات أولاً',
'RT_ANNOUNCEMENTS_FIRST_EXP' => 'ينقل الإعلانات والإعلانات العامة في كل صفحة من القائمة إلى أعلى تلك الصفحة. لا تتم إضافة الإعلانات الأقدم غير الموجودة في الصفحة.',
'RT_ANTI_TOPICS' => 'المواضيع المُستبعدة ',
'RT_ANTI_TOPICS_EXP' => 'اكتب علامة الفاصلة ", " بين أرقام المواضيع التي تريد عدم ظهورها في "أحدث المواضيع" ( مثال : 7,9 )',
'RT_PARENTS' => 'إظهار المنتدى الأب ',
Expand Down
2 changes: 2 additions & 0 deletions language/cs/info_acp_recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
'RT_PAGE_NUMBERMAX_EXP' => 'Nastavte maximum stránek pro zobrazení ve stránkování nedávných témat (není-li přepsáno jiným nastavením).',
'RT_MIN_TOPIC_LEVEL' => 'Minimální úroveň tématu',
'RT_MIN_TOPIC_LEVEL_EXP' => 'Určuje minimální úroveň typu tématu pro zobrazení. Zobrazena budou pouze témata zvolené úrovně a vyšší.',
'RT_ANNOUNCEMENTS_FIRST' => 'Zobrazit oznámení jako první',
'RT_ANNOUNCEMENTS_FIRST_EXP' => 'Přesune oznámení a globální oznámení na každé stránce seznamu na začátek dané stránky. Starší oznámení, která na stránce nejsou, se nepřidávají.',
'RT_ANTI_TOPICS' => 'Vyloučená témata',
'RT_ANTI_TOPICS_EXP' => 'Identifikátory témat k vyloučení, oddělené čárkou „,“ (příklad: 7,9)<br />',
'RT_PARENTS' => 'Zobrazit nadřazená fóra',
Expand Down
2 changes: 2 additions & 0 deletions language/de/info_acp_recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
'RT_PAGE_NUMBERMAX_EXP' => 'Lege die maximale Anzahl der Seiten fest.',
'RT_MIN_TOPIC_LEVEL' => 'Minimaler Thementyp',
'RT_MIN_TOPIC_LEVEL_EXP' => 'Definiert das Minimum des anzuzeigenden Thementyps. Wenn du einen Thementyp angibst, werden nur Themen dieses oder eines höheren Typs angezeigt.',
'RT_ANNOUNCEMENTS_FIRST' => 'Bekanntmachungen zuerst anzeigen',
'RT_ANNOUNCEMENTS_FIRST_EXP' => 'Verschiebt die Bekanntmachungen und globalen Bekanntmachungen auf jeder Seite der Liste an den Anfang dieser Seite. Ältere Bekanntmachungen, die nicht auf der Seite stehen, werden nicht hinzugefügt.',
'RT_ANTI_TOPICS' => 'Ausgeschlossene Themen',
'RT_ANTI_TOPICS_EXP' => 'Gib die Themen-IDs ein, kommagetrennt (z. B. 7,9), andernfalls 0, um alle Themen anzuzeigen (wie in der URL viewtopic.php?t=12345).',
'RT_PARENTS' => 'Übergeordnete Foren anzeigen',
Expand Down
2 changes: 2 additions & 0 deletions language/de_x_sie/info_acp_recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
'RT_PAGE_NUMBERMAX_EXP' => 'Legt die maximale Anzahl der Seiten fest.',
'RT_MIN_TOPIC_LEVEL' => 'Minimaler Thementyp',
'RT_MIN_TOPIC_LEVEL_EXP' => 'Definiert das Minimum eines Thementyps, der angezeigt wird. Wenn Sie einen Thementyp angeben, werden nur Themen dieses oder eines höheren Typs angezeigt.',
'RT_ANNOUNCEMENTS_FIRST' => 'Bekanntmachungen zuerst anzeigen',
'RT_ANNOUNCEMENTS_FIRST_EXP' => 'Verschiebt die Bekanntmachungen und globalen Bekanntmachungen auf jeder Seite der Liste an den Anfang dieser Seite. Ältere Bekanntmachungen, die nicht auf der Seite stehen, werden nicht hinzugefügt.',
'RT_ANTI_TOPICS' => 'Ausgeschlossene Themen',
'RT_ANTI_TOPICS_EXP' => 'Geben Sie die Themen-IDs ein, kommagetrennt (z. B. 7,9), andernfalls 0, um alle Themen anzuzeigen (wie in der URL viewtopic.php?t=12345).',
'RT_PARENTS' => 'Übergeordnete Foren anzeigen',
Expand Down
2 changes: 2 additions & 0 deletions language/en/info_acp_recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
'RT_PAGE_NUMBERMAX_EXP' => 'Set the page maximum to display in the recent topics pagination unless overridden.',
'RT_MIN_TOPIC_LEVEL' => 'Minimum topic type level',
'RT_MIN_TOPIC_LEVEL_EXP' => 'Determines the minimum level of the topic-type to display. It will only display topics of the set level and higher.',
'RT_ANNOUNCEMENTS_FIRST' => 'Show announcements first',
'RT_ANNOUNCEMENTS_FIRST_EXP' => 'Moves the announcements and global announcements on each page of the list to the top of that page. Older announcements that are not on the page are not added.',
'RT_ANTI_TOPICS' => 'Excluded topic IDs',
'RT_ANTI_TOPICS_EXP' => 'The IDs of topics to exclude, separated by “,” (Example: 7,9)<br />The value 0 disables this behaviour.',
'RT_PARENTS' => 'Display parent forums',
Expand Down
2 changes: 2 additions & 0 deletions language/es/info_acp_recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
'RT_PAGE_NUMBERMAX_EXP' => 'Definir el número máximo de páginas',
'RT_MIN_TOPIC_LEVEL' => 'Nivel de tema mínimo',
'RT_MIN_TOPIC_LEVEL_EXP' => 'Determina el nivel de tema mínimo para poder ser mostrado. Solo mostrará temas del nivel especificado y superior.',
'RT_ANNOUNCEMENTS_FIRST' => 'Mostrar primero los anuncios',
'RT_ANNOUNCEMENTS_FIRST_EXP' => 'Coloca los anuncios y anuncios globales de cada página de la lista al principio de esa página. Los anuncios más antiguos que no estén en la página no se añaden.',
'RT_ANTI_TOPICS' => 'Temas excluidos',
'RT_ANTI_TOPICS_EXP' => 'Las IDs de los temas a excluir, separados por "," (Por ejemplo: 7,9)<br />Si no quiere excluir un tema, simplemente introduzca 0.',
'RT_PARENTS' => 'Mostrar foros padre',
Expand Down
2 changes: 2 additions & 0 deletions language/es_x_tu/info_acp_recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
'RT_PAGE_NUMBERMAX_EXP' => 'Definir el número máximo de páginas',
'RT_MIN_TOPIC_LEVEL' => 'Nivel de tema mínimo',
'RT_MIN_TOPIC_LEVEL_EXP' => 'Determina el nivel de tema mínimo para poder ser mostrado. Solo mostrará temas del nivel especificado y superior.',
'RT_ANNOUNCEMENTS_FIRST' => 'Mostrar primero los anuncios',
'RT_ANNOUNCEMENTS_FIRST_EXP' => 'Coloca los anuncios y anuncios globales de cada página de la lista al principio de esa página. Los anuncios más antiguos que no estén en la página no se añaden.',
'RT_ANTI_TOPICS' => 'Temas excluidos',
'RT_ANTI_TOPICS_EXP' => 'Las IDs de los temas a excluír, separados por "," (Por ejemplo: 7,9)<br />Si no quieres excluir un tema, simplemente introduce 0.',
'RT_PARENTS' => 'Mostrar foros padre',
Expand Down
2 changes: 2 additions & 0 deletions language/fr/info_acp_recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
'RT_PAGE_NUMBERMAX_EXP' => 'Permet de saisir le nombre maximal de pages à afficher dans la pagination des sujets récents lorsque l’option « Afficher toutes les pages des sujets récents » est désactivée (décochée).',
'RT_MIN_TOPIC_LEVEL' => 'Niveau minimum du type de sujets affichés',
'RT_MIN_TOPIC_LEVEL_EXP' => 'Permet de sélectionner le niveau minimum du type de sujets à afficher dans la liste des sujets récents. Les sujets correspondants au niveau paramétré et aux niveaux supérieurs seront affichés.',
'RT_ANNOUNCEMENTS_FIRST' => 'Afficher les annonces en premier',
'RT_ANNOUNCEMENTS_FIRST_EXP' => 'Place les annonces et annonces globales de chaque page de la liste en haut de cette page. Les annonces plus anciennes qui ne figurent pas sur la page ne sont pas ajoutées.',
'RT_ANTI_TOPICS' => 'Exclure des sujets de l’affichage',
'RT_ANTI_TOPICS_EXP' => 'Permet de saisir les ID, séparés par une virgule (exemple : 7,9), des sujets à exclure de l’affichage des sujets récents.<br />Pour afficher tous les sujets saisir la valeur 0.',
'RT_PARENTS' => 'Afficher les forums parents',
Expand Down
2 changes: 2 additions & 0 deletions language/nl/info_acp_recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
'RT_PAGE_NUMBERMAX_EXP' => 'Stel het maximum aantal pagina’s in.',
'RT_MIN_TOPIC_LEVEL' => 'Onderwerptypes',
'RT_MIN_TOPIC_LEVEL_EXP' => 'Stel het minimum weer te geven onderwerptype in.',
'RT_ANNOUNCEMENTS_FIRST' => 'Mededelingen eerst tonen',
'RT_ANNOUNCEMENTS_FIRST_EXP' => 'Plaatst de mededelingen en algemene mededelingen op elke pagina van de lijst bovenaan die pagina. Oudere mededelingen die niet op de pagina staan, worden niet toegevoegd.',
'RT_ANTI_TOPICS' => 'Uitgesloten onderwerpen',
'RT_ANTI_TOPICS_EXP' => 'Vul de onderwerp id’s in (bijvoorbeeld 7,9), anders 0. (deze nummers vind je in de url viewtopic.php?t=12345)',
'RT_PARENTS' => 'Weergeven van hoofdforums',
Expand Down
2 changes: 2 additions & 0 deletions language/pt/info_acp_recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
'RT_PAGE_NUMBERMAX_EXP' => 'Defina o máximo da página para exibir na paginação dos tópicos recentes, a menos que seja substituído.',
'RT_MIN_TOPIC_LEVEL' => 'Nível mínimo do tipo de tópico',
'RT_MIN_TOPIC_LEVEL_EXP' => 'Determina o nível mínimo do tipo de tópico a ser exibido. Ele só exibirá tópicos do nível definido e mais alto.',
'RT_ANNOUNCEMENTS_FIRST' => 'Mostrar anúncios primeiro',
'RT_ANNOUNCEMENTS_FIRST_EXP' => 'Coloca os anúncios e anúncios globais de cada página da lista no topo dessa página. Anúncios mais antigos que não estejam na página não são adicionados.',
'RT_ANTI_TOPICS' => 'ID de tópico excluído',
'RT_ANTI_TOPICS_EXP' => 'Os IDs de tópicos a excluir, separados por "," (Exemplo: 7,9) <br />O valor 0 desabilita esse comportamento.',
'RT_PARENTS' => 'Mostrar Fórum Pai',
Expand Down
2 changes: 2 additions & 0 deletions language/ru/info_acp_recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
'RT_PAGE_NUMBERMAX_EXP' => 'Максимальное число страниц для отображения в блоке последних тем (если значение не переопределено).',
'RT_MIN_TOPIC_LEVEL' => 'Минимальный статус темы',
'RT_MIN_TOPIC_LEVEL_EXP' => 'Минимальный статус темы для отображения. В списке последних тем будут отображены темы, имеющие указанный статус, и выше.<br />(0 = обычная, 1 = прилепленная, 2 = объявление, 3 = важная)',
'RT_ANNOUNCEMENTS_FIRST' => 'Показывать объявления первыми',
'RT_ANNOUNCEMENTS_FIRST_EXP' => 'Перемещает объявления и глобальные объявления на каждой странице списка в начало этой страницы. Более старые объявления, которых нет на странице, не добавляются.',
'RT_ANTI_TOPICS' => 'Исключённые темы',
'RT_ANTI_TOPICS_EXP' => 'Разделённый запятыми список идентификаторов тем, которые не должны отображаться в списке последних тем (например: 7, 9)<br />Установите 0 для отключения данной функции.',
'RT_PARENTS' => 'Показать родительские форумы',
Expand Down
2 changes: 2 additions & 0 deletions language/sk/info_acp_recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
'RT_PAGE_NUMBERMAX_EXP' => 'Nastavte maximum stránok pre zobrazenie v stránkovaní najnovších tém (ak nie je prepísané iným nastavením).',
'RT_MIN_TOPIC_LEVEL' => 'Minimálna úroveň témy',
'RT_MIN_TOPIC_LEVEL_EXP' => 'Určuje minimálnu úroveň typu témy pre zobrazenie. Zobrazené budú iba témy zvolenej úrovne a vyššie.',
'RT_ANNOUNCEMENTS_FIRST' => 'Zobraziť oznámenia ako prvé',
'RT_ANNOUNCEMENTS_FIRST_EXP' => 'Presunie oznámenia a globálne oznámenia na každej stránke zoznamu na začiatok danej stránky. Staršie oznámenia, ktoré na stránke nie sú, sa nepridávajú.',
'RT_ANTI_TOPICS' => 'Vylúčené témy',
'RT_ANTI_TOPICS_EXP' => 'ID tém na vylúčenie, oddelené čiarkou „," (príklad: 7,9)<br />Hodnota 0 túto funkciu vypne.',
'RT_PARENTS' => 'Zobraziť nadradené fóra',
Expand Down
2 changes: 2 additions & 0 deletions language/sv/info_acp_recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
'RT_PAGE_NUMBERMAX_EXP' => 'Ange det maximala antalet sidor att visa i pagineringen av senaste trådar om det inte åsidosätts.',
'RT_MIN_TOPIC_LEVEL' => 'Lägsta trådtypsnivå',
'RT_MIN_TOPIC_LEVEL_EXP' => 'Bestämmer den lägsta nivån av trådtyp som ska visas. Endast trådar av den angivna nivån och högre visas.',
'RT_ANNOUNCEMENTS_FIRST' => 'Visa meddelanden först',
'RT_ANNOUNCEMENTS_FIRST_EXP' => 'Flyttar meddelanden och globala meddelanden på varje sida i listan överst på den sidan. Äldre meddelanden som inte finns på sidan läggs inte till.',
'RT_ANTI_TOPICS' => 'Exkluderade tråd-ID:n',
'RT_ANTI_TOPICS_EXP' => 'ID:n för trådar att exkludera, separerade med "," (Exempel: 7,9)<br />Värdet 0 inaktiverar denna funktion.',
'RT_PARENTS' => 'Visa överordnade forum',
Expand Down
2 changes: 2 additions & 0 deletions language/uk/info_acp_recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
'RT_PAGE_NUMBERMAX_EXP' => 'Вкажіть максимальну кількість сторінок для відображення в списку тем.',
'RT_MIN_TOPIC_LEVEL' => 'Мінімальний тип теми',
'RT_MIN_TOPIC_LEVEL_EXP' => 'Цей параметр визначає мінімальний рівень типу тем. Буде відображено теми тільки вказаного рівня і вище.',
'RT_ANNOUNCEMENTS_FIRST' => 'Показувати оголошення першими',
'RT_ANNOUNCEMENTS_FIRST_EXP' => 'Переміщує оголошення та глобальні оголошення на кожній сторінці списку на початок цієї сторінки. Старіші оголошення, яких немає на сторінці, не додаються.',
'RT_ANTI_TOPICS' => 'Не відображати теми з вказаними ID',
'RT_ANTI_TOPICS_EXP' => 'Теми з вказаними ID будуть виключені зі списку відображення. Кожен ID теми має бути розділений комою “,” (Наприклад: 7,9)<br />Значення "0" деактивує цей список виключення.',
'RT_PARENTS' => 'Відображати батьківські форуми',
Expand Down
38 changes: 38 additions & 0 deletions migrations/v300/release_3_0_12.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
*
* @package Recent Topics Extension
* @copyright (c) 2026 Andreas Vandenberghe (avathar)
* @license GNU General Public License, version 2 (GPL-2.0)
*
* Release 3.0.12 — adds the "Show announcements first" setting (issue #201).
*/

namespace avathar\recenttopics\migrations\v300;

class release_3_0_12 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return isset($this->config['rt_announcements_first']);
}

public static function depends_on()
{
return ['\avathar\recenttopics\migrations\v300\release_3_0_0'];
}

public function update_data()
{
return [
['config.add', ['rt_announcements_first', 0]],
];
}

public function revert_data()
{
return [
['config.remove', ['rt_announcements_first']],
];
}
}
Loading
Loading