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 ???

edited June 2007 in Vanilla 1.0 Help
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?


  • Options
    lechlech Chicagoland
    Not without a clever add-on or modified template to sort discussions the way you want them, no. Your users may have better results using the search feature rather than having to dig through a copious amount of discussions to reach something towards the back of the alphabet.
  • Options
    The chronological extension changes the sort by tricking Vanilla into sorting on a different column, although I never felt quite right about the method used there.

    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?
  • Options
    edited June 2007
    I did a little test with Mark's DiscussionFilters add-on. I added an option called "Sorted Discussions". It works but it sounds like you want your default on your forum to be sorted by Discussion Name.
    $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: Description: Sorts the Discussions alphanetically. Based on Mark's DiscussionFilters extension. Version: 1.0.0 Author: Jim Wurster Author Url: */ 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.
This discussion has been closed.