[CDB] Sort Topics

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Ideas Centre
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 3210
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

[CDB] Sort Topics

Post by kasimi » Sat Dec 05, 2015 7:25 pm

Extension Name: Sort Topics (requires at least phpBB 3.1.4-RC1)

Author: kasimi

Description: Extends the ACP 'General forum settings' section for each forum by an option that allows the administrator to force the way topics are sorted, overriding the user's UCP setting.

Also optionally extends the UCP -> Board preferences -> Display options -> Topics ordering list by 'Created time' for each user, resulting in all topics being sorted by topic creation time when viewing any forum.

Notes about performance:
  • The extension does not perform addition SQL queries.
  • The extension adds 1 column to the phpbb_users table and 2 columns to the phpbb_forums table.
Current status: The advertised features are fully implemented and, as far as I can tell, are working reliably. I'm still open for suggestions to improve the extension, that's why it's tagged as DEV.

Screenshots:
  • ACP -> Forums -> Create/Edit forum:
    Image
  • ACP -> Extension -> Sort Topics Configuration:
    Image
  • UCP -> Board preferences -> Edit display options:
    Image
Download v1.0.3: https://github.com/kasimi/phpbb-ext-sor ... v1.0.3.zip

Repository: https://github.com/kasimi/phpbb-ext-sorttopics

Installation:
  1. Copy the contents of the archive to /ext/kasimi/sorttopics.
    Make sure the file /ext/kasimi/sorttopics/composer.json is present.
  2. Navigate to the ACP » Customise » Manage extensions page.
  3. Click Enable next to Sort Topics in the Disabled Extensions section.
Changelog:
  • 2015-12-05 v1.0.0 Initial release
  • 2016-02-14 v1.0.1
    1. Added option to apply sorting to all sub-forums
    2. Moved ACP forum options to separate fieldset
  • 2016-04-01 v1.0.2
    1. Fixed applying sorting options to sub-forums
  • 2016-05-12 v1.0.3
    1. Fixed bug when using temporary viewforum sorting with start parameter greater zero.
    2. Added temporary viewforum sorting parameters to pagination links and forum title link.
    3. Improved performance of SQL query for forums with many topics.
Last edited by kasimi on Sat Jul 30, 2016 9:43 pm, edited 6 times in total.

User avatar
LordOfFlies
Registered User
Posts: 63
Joined: Tue Jul 14, 2015 6:55 am
Name: Matěj Štágl
Contact:

Re: [DEV] Sort Topics

Post by LordOfFlies » Sat Dec 05, 2015 7:39 pm

I have a suggestion. What about some kind of order for sticky topics? That would be really nice.
Thanks for your hard work. :)

HeinrichP
Registered User
Posts: 28
Joined: Wed Oct 14, 2015 8:15 pm

Re: [DEV] Sort Topics

Post by HeinrichP » Sat Dec 05, 2015 10:09 pm

great!!! big thanks kasimi

frankingermann
Registered User
Posts: 25
Joined: Sat Nov 21, 2015 4:51 pm
Location: Monschau, Germany
Name: Frank Ingermann

Re: [DEV] Sort Topics

Post by frankingermann » Sun Dec 06, 2015 9:26 pm

Hi kasimi,

this is great - thanks a lot for your work!

Since you're open to suggestions, here's one that would be very useful: ;)

What about an option to "inherit" sorting settings. Imagine you have a main forum with 20
subforums. You would set the sort options once in the main forum and set all of the
subforums to "inherit". Changing the option for the main forum would change it
in all subforums as well. Does this make any sense to you? Hope it does... :)

cheers, Frank

P.S.: German translation for the "de" folder:

Code: Select all

<?php

/**
 *
 * @package phpBB Extension - Sort Topics
 * @copyright (c) 2015 kasimi
 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
 *
 */

if (!defined('IN_PHPBB'))
{
	exit;
}

if (empty($lang) || !is_array($lang))
{
	$lang = array();
}

$lang = array_merge($lang, array(
	'SORTTOPICS_TITLE'						=> 'Themen sortieren',
	'SORTTOPICS_CONFIG'						=> 'Konfiguration',
	'SORTTOPICS_CONFIG_UPDATED'				=> '<strong>Sort Topics</strong>Extension<br />» Konfiguration aktualisiert',

	'SORTTOPICS_UCP_ENABLED'				=> 'Erlaube Benutzern global, Themen nach Eröffnungsdatum zu sortieren',
	'SORTTOPICS_UCP_ENABLED_EXPLAIN'		=> 'Gibt Benutzern im persönlichen Bereich die Möglichkeit, in allen Foren die Themen nach Eröffnungsdatum zu sortieren.',

	'SORTTOPICS_SORT_TOPICS_BY'				=> 'Sortiere Themen nach',
	'SORTTOPICS_SORT_TOPICS_BY_EXPLAIN'		=> 'Jeder andere Wert als \'Benutzer-Standard\' erzwingt die anfängliche Sortierung wie hier angegeben, unabhängig von der Standard-Einstellung des Benutzers im persönlichen Bereich. Der Benutzer hat dennoch die Möglichkeit, die Reihenfolge am Ende der Forenindex-Seite temporär umzuschalten.',
	'SORTTOPICS_SORT_TOPICS_ORDER'			=> 'Reihenfolge',
	'SORTTOPICS_SORT_TOPICS_ORDER_EXPLAIN'	=> 'Diese Option wirkt sich nur aus, wenn oben etwas anderes als \'Benutzer-Standard\' gewählt wurde.',
	'SORTTOPICS_USER_DEFAULT'				=> 'Benutzer-Standard',
	'SORTTOPICS_CREATED_TIME'				=> 'Eröffnungsdatum',
));

User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 3210
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [DEV] Sort Topics

Post by kasimi » Sun Dec 06, 2015 9:47 pm

Sounds interesting, I'll look into it. Thanks for the translation! :)

User avatar
Raul [ThE KuKa]
Jr. Extension Validator
Posts: 4625
Joined: Mon Dec 08, 2003 9:24 pm
Location: Spain
Name: Raul Arroyo
Contact:

Re: [DEV] Sort Topics

Post by Raul [ThE KuKa] » Sun Dec 06, 2015 10:06 pm

"PR" Spanish translation ready. :wink:
If you like my styles, translations, etc. and want to show some appreciation, then feel free to Donate with Image
phpBB International Support Team (Spanish - Español) :flag_es: Online Since 2003 - 15th anniversary
🎨phpBB Professional Premium Themes🔥
Author Translations (Spanish - Spain) :two_hearts:

:warning: I don't support those without the copyright Spanish translation. :warning:

User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 3210
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [DEV] Sort Topics

Post by kasimi » Sun Dec 06, 2015 10:53 pm

Thanks Raul. :)
frankingermann wrote:set all of the subforums to "inherit"
Wouldn't it be more user-friendly if the administrator doesn't have to go through all subforums? How about a new preference when editing a forum: "Update all subforums Yes/No". If set to Yes on submit, the sorting you choose for the current forum is also applied to all child forums. This would also have the advantage that, when viewing a forum, the sorting wouldn't have to be calculated by checking parent forums. Can you think of any downsides this approach might have?

frankingermann
Registered User
Posts: 25
Joined: Sat Nov 21, 2015 4:51 pm
Location: Monschau, Germany
Name: Frank Ingermann

Re: [DEV] Sort Topics

Post by frankingermann » Sun Dec 06, 2015 11:38 pm

this would be a "push"- rather than a "pull"- approach - yeah, why not?

The outcome would be the same, practically. But it would reduce the load
when viewing the (sub-)forums - no need for additional SELECTS to find out
how to sort the currently viewed forum. Yes, that sounds very reasonable !!

cheers, Frank

User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 3210
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [DEV] Sort Topics

Post by kasimi » Mon Dec 07, 2015 1:46 am

Thanks for your feedback, new code is pushed to master. There are two new language variables, I'd appreciate a translation for those. :)

https://github.com/kasimi/phpbb-ext-sor ... 576465ee33

frankingermann
Registered User
Posts: 25
Joined: Sat Nov 21, 2015 4:51 pm
Location: Monschau, Germany
Name: Frank Ingermann

Re: [DEV] Sort Topics

Post by frankingermann » Mon Dec 07, 2015 2:06 am

wow, that's fast :!:

i'll try the new version asap, and will update the German translation tomorrow.
It's "head meets pillow" time now, though... ;)

cheers, Frank

frankingermann
Registered User
Posts: 25
Joined: Sat Nov 21, 2015 4:51 pm
Location: Monschau, Germany
Name: Frank Ingermann

Re: [DEV] Sort Topics

Post by frankingermann » Mon Dec 07, 2015 6:35 pm

just installed the new version - it works great, thanks a lot!

We will have a complex structure of sub-forums with sub-sub-forums
in our upcoming phpbb3 forum, so this copy-to-subforums feature makes
life a whole lot easier. Especially since you made it so that it copies
the settings n-levels deep, not just one (might be worth a mention
in the explanation - i already wrote it into the german translation.)

Keep up the great work!

New German translation: ( i should learn to do Pull Requests, i know... ;) )

Code: Select all

<?php

/**
 *
 * @package phpBB Extension - Sort Topics
 * @copyright (c) 2015 kasimi
 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
 *
 */

if (!defined('IN_PHPBB'))
{
	exit;
}

if (empty($lang) || !is_array($lang))
{
	$lang = array();
}

$lang = array_merge($lang, array(
	'SORTTOPICS_TITLE'						=> 'Themen sortieren',
	'SORTTOPICS_CONFIG'						=> 'Konfiguration',
	'SORTTOPICS_CONFIG_UPDATED'				=> '<strong>Sort Topics</strong>Extension<br />» Konfiguration aktualisiert',

	'SORTTOPICS_UCP_ENABLED'				=> 'Erlaube Benutzern global, Themen nach Eröffnungsdatum zu sortieren',
	'SORTTOPICS_UCP_ENABLED_EXPLAIN'		=> 'Gibt Benutzern im persönlichen Bereich die Möglichkeit, in allen Foren die Themen nach Eröffnungsdatum zu sortieren.',

	'SORTTOPICS_SORT_TOPICS_BY'				=> 'Sortiere Themen nach',
	'SORTTOPICS_SORT_TOPICS_BY_EXPLAIN'		=> 'Jeder andere Wert als “Benutzer-Standard” erzwingt die anfängliche Sortierung wie hier angegeben, unabhängig von der Standard-Einstellung des Benutzers im persönlichen Bereich. Der Benutzer hat dennoch die Möglichkeit, die Reihenfolge am Ende der Forenindex-Seite temporär umzuschalten.',
	'SORTTOPICS_SORT_TOPICS_ORDER'			=> 'Reihenfolge',
	'SORTTOPICS_SORT_TOPICS_ORDER_EXPLAIN'	=> 'Diese Option wirkt sich nur aus, wenn oben etwas anderes als “Benutzer-Standard” gewählt wurde.',
	'SORTTOPICS_APPLY_TO_SUBFORUMS'			=> 'Sortier-Einstellungen in Unter-Foren kopieren',
	'SORTTOPICS_APPLY_TO_SUBFORUMS_EXPLAIN'	=> 'Wenn ja, werden die obigen Einstellungen in alle Unter-Foren des Forums (und deren Unter-Foren) kopiert.',
	'SORTTOPICS_USER_DEFAULT'				=> 'Benutzer-Standard',
	'SORTTOPICS_CREATED_TIME'				=> 'Eröffnungsdatum',
));

User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 3210
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [DEV] Sort Topics

Post by kasimi » Mon Dec 07, 2015 7:06 pm

English wording has been adjusted and German translation updated, thanks!

joe92
Registered User
Posts: 50
Joined: Sun Oct 04, 2015 1:04 pm

Re: [DEV] Sort Topics

Post by joe92 » Mon Dec 07, 2015 7:41 pm

italian

Code: Select all

<?php

/**
 *
 * @package phpBB Extension - Sort Topics
 * @copyright (c) 2015 kasimi
 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
 *
 */

if (!defined('IN_PHPBB'))
{
	exit;
}

if (empty($lang) || !is_array($lang))
{
	$lang = array();
}

$lang = array_merge($lang, array(
	'SORTTOPICS_TITLE'						=> 'Ordina Argomenti',
	'SORTTOPICS_CONFIG'						=> 'Configurazione',
	'SORTTOPICS_CONFIG_UPDATED'				=> '<strong>Estensione</strong> Ordina Argomenti<br />» Configurazione aggiornata',

	'SORTTOPICS_UCP_ENABLED'				=> 'Consenti agli utenti di ordinare i messaggi creati a livello globale',
	'SORTTOPICS_UCP_ENABLED_EXPLAIN'		=> 'Darà agli utenti la possibilità in PCU di ordinare i messaggi creati in tutti i forum.',

	'SORTTOPICS_SORT_TOPICS_BY'				=> 'Ordina argomenti per',
	'SORTTOPICS_SORT_TOPICS_BY_EXPLAIN'		=> 'Un valore diverso \'default utente\' forza gli argomenti in questo forum da essere inizialmente ordinati per la chiave specificata, ignorando le preferenze di ordinamento utente/i in PCU. L’utente è ancora in grado di modificare temporaneamente l’ordinamento in fondo a ogni pagina in viewforum.',
	'SORTTOPICS_SORT_TOPICS_ORDER'			=> 'Ordinamento argomenti',
	'SORTTOPICS_SORT_TOPICS_ORDER_EXPLAIN'	=> 'Questa opzione ha effetto solo se l’opzione precedente è impostata su un valore diverso in \'default utente\'.',
	'SORTTOPICS_APPLY_TO_SUBFORUMS'			=> 'Applica informazione ordinamento argomento di questo forum e per tutti i sub-forum',
	'SORTTOPICS_APPLY_TO_SUBFORUMS_EXPLAIN'	=> 'Se impostato su "SI", le preferenze di ordinamento di cui sopra si applicano a questo forum e tutti i sub-forum (e i loro sub-forum).',
	'SORTTOPICS_USER_DEFAULT'				=> 'Default utente',
	'SORTTOPICS_CREATED_TIME'				=> 'Ora di creazione',
));
Last edited by joe92 on Sat Apr 02, 2016 1:44 am, edited 1 time in total.

User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 3210
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [DEV] Sort Topics

Post by kasimi » Mon Dec 07, 2015 7:57 pm

Pushed, thanks!

User avatar
Mauron
Registered User
Posts: 342
Joined: Wed Jul 16, 2014 11:25 am

Re: [DEV] Sort Topics

Post by Mauron » Mon Dec 07, 2015 9:32 pm

joe92 wrote:italian
[...]
Ew, gross!

Locked

Return to “Extensions in Development”

Who is online

Users browsing this forum: Google [Bot] and 16 guests