Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Discussions alphabetically sorted ???
I'm managing a bookswap forum, the threads are the books titles and need to be alphabetically sorted. Is there any way to achieve this?
0
This discussion has been closed.
Comments
Lech is right about possible problems this could cause--"Alice in Wonderland" would wind up being swapped much more often than "Moby Dick".
Maybe something as low-tech as putting a post-it note inside the book with the discussion's URL would be better?
$s->AddOrderBy('Name', 't', 'asc');
You could make a simple extension to automatically sort them and here it is:
<?php /* Extension Name: DiscussionSort Extension Url: http://lussumo.com/docs/ Description: Sorts the Discussions alphanetically. Based on Mark's DiscussionFilters extension. Version: 1.0.0 Author: Jim Wurster Author Url: http://www.jwurster.us/ */ if (!defined('IN_VANILLA')) exit(); // Set the version number. AddConfigurationSetting($Context, 'DISCUSSIONSORT_VERSION', '1.0.0'); $Context->SetDefinition('SortedDiscussions', 'Sorted Discussions'); // Apply any necessary filters if ($Context->SelfUrl == "index.php") { $Context->PageTitle = $Context->GetDefinition("SortedDiscussions"); function DiscussionManager_FilterDataToSortedDiscussions(&$DiscussionManager) { $s = &$DiscussionManager->DelegateParameters['SqlBuilder']; $s->AddOrderBy('Name', 't', 'asc'); } $Context->AddToDelegate("DiscussionManager", "PreGetDiscussionList", "DiscussionManager_FilterDataToSortedDiscussions"); $Context->AddToDelegate("DiscussionManager", "PreGetDiscussionCount", "DiscussionManager_FilterDataToSortedDiscussions"); } ?>
I should say, that if the code looks good, I'll upload it. I know it works, but if anyone could give it a quick look, I would appreciate it.
Edit: Now that you have the Discussions (Books) sorted alphabetically, I went one step further to give you quick access to all the Discussions (Books) that begin with each letter. I list in a horizontal menu, each letter which displays the number of Discussions (Books) when you hover over it. When you click on a letter it displays the page with only those Discussions (Books) that begin with that letter.
I'm going to do some further testing, but will upload it tomorrow.