Sort Discussion Lists=Tagged, by Title
[Vanilla Forum 3.1]
I have a query about how to sort the discussion list when you use tags.
At the moment, it sorts by latest comment, actually across all discussion lists it sorts by latest comment. That's fine, I acknowledge that.
However, when I click on a Tag with all the discussions showing up, I'd like for them to be displayed using the Title as the sort order instead.
We run a music portal, and our title is setup looks like this:
<artist (surname first) or band> - <year> <release title>
Obviously if its an artist/band with loads of albums, it gets a bit messy if discussions are jumping around all the time if people are commenting on them.
We just want to improve navigation, as that's what everyone was used to on our previous CMS.
Am I able to isolate the discussion lists by tags only? And to have them sorted by title; yes it's a different order to what the default is across the site.
I'm not quite sure whereabouts is the configuration detail for this to be edited.
Any assistance would be gratefully appreciated.
Comments
Related to...
https://open.vanillaforums.com/discussion/37780/how-to-sort-discussions-based-on-the-discussion-table-column
For your own enlightenment (for I found this thread immensely revolutionary for me)
https://open.vanillaforums.com/discussion/32730/any-example-of-using-the-new-sort-filter-module
In my case, I wanted some sort of superior flexibility (no pun intended). I wanted to be able to pass the url, change the params to whatever I wanted on the fly, via AJAX, link hrefs or whatever I wanted. And as you noted, the tags list is really a mere discussionlist, so the code I give you works site-wide, directly, with the exception of discussions/participated and discussions/unread. These two areas use different events.
Create a plugin and dump this in there and relax...
example.com/discussions/tagged/mozart?sort=title
will sort by title with default order of descending
example.com/discussions/tagged/mozart?sort=title:asc
will sort by title with order of ascending
example.com/discussions/tagged/mozart?sort=title:asc*replies:desc*activity:desc will sort by title, number of replies and last comment/activity
In
$discussionColumns
add what else you want.Let me know if this answers your question. It's late here and I am working without my glasses, so anything is possible - I might even be on the wrong forum web site.
Cheers.
@donshakespeare
Thanks, it's great knowing there is a solution available. I am brand new to Vanilla forums, so I haven't yet worked out how to build a plugin, I tried looking for some tutorial on it but I didn't see any.
I have every confidence that we will get there eventually. :)
Okay. I uploaded it for you. Unzip the folder so that you have this as valid on your server
example.com/plugins/SortMaster/class.sortmaster.php
@donshakespeare
Ok, that's great, I can see the changes and sort ordering being rearranged as I bolt on those parameters to the url.
Am I correct in assuming that this is just a manual work around? We can't persist the code to be a permanent change?
Also, if my discussion lists spans more than one page (let's say page total is only 20 items, and I've got 100, there will be 5 Pages), my newly sorted list gets dropped in favour of the /p2 string, and so on..
Unless I'm missing something here?
For permanent persistence and page fix, find...
and replace with...
When this plugin becomes official, it shall have all these niceties and better configuration.
Now you don't need url parameters to activate sort.
For the future, you can use PHP or JavaScript to create/alter url links to have sort the param (if you want)
Cheers
Beautiful! When it becomes official I'll have to pop the Cork in celebration!
Did you alter it to work for you?
@donshakespeare
I did indeed!
However it re-sorted it everywhere across the site, including the Recent Discussions List.
We use Announcements, so those discussions are exempt obviously and are prioritised at the top of the Recent Discussions List, which is how it should be, no problems there. Also, we like the Recent Discussions being ordered by latest comment, so this plugin overrides it.
So I've switched it back in the meantime, as we are still back porting a lot of old content from our previous CMS, so that will take priority in the over the next few weeks.
When it comes to officially creating the plugin, I can give you a hand with the testing of it. I used to be a QA tester and Technical Writer for a handful of software dev companies in my shady past.. Lol
Yup, absolutely, making it work in certain areas of the site is rather trivial.
Thanks for the feedback and future ones as well. And yes, thy shady past shall be handy. :)
Cheers!