![]() |
Nice mod :)
I have a question, is it possible to sort posts within a thread accordingly to the post ranking? (Yup, I dig the whole thread but did not find it.) And if yes then how? I would be grateful for any pointers. |
Quote:
Basically you'd need to modify the query that pulls the posts up and change it to check on the votes for the post (they're stored as individual records and for the post overall). There's already a query plugin used on that page so it's got a starting point if you're familiar with vB. |
Well, I'm familiar with vb in some way, but I'm not a coder. As for modifying I would only like to execute sorting only on demand, not by default. I guess I need to edit showthread template and put there a link that will run the sorting query when user clicks it. To create the query I must add a plugin and place it somewhere within showthread perhaps showthread_start hook or maybe showthread_query_postids hook would be suitable.
But the question is how would look like the code executing this query. I've just thought that perhaps someone has done it before and wouldn't mind to share the code. I think that feature could be very powerful addition to this mod. |
Quote:
Here's the basics of what you need to do: 1. Add a plugin hook for showthread_post_start along the lines of Code:
// get the variable to see if the user wants to sort by votes 3. Repeat this for all 3 instances of the original code 4. Add a link to the post with the variable &sortvotes=1 to enable sorting by votes 5. To check that the plugin is getting called view source the page and look for "sort by posts" or "sort normally". You can remove this once the hack works. Note: This isn't tested so while it won't destroy any data it may throw an error and may not work if you filter a post another way, click to the next page, etc. |
It works :) but only partially. It executes the normal sorting and displays the posts, (<!--sort normally--> is displayed too)
but when trying to sort by helpfulpost.totalrank by accessing http://www.example.com/showthread.php?t=xxx&sortvotes=1 a db error occurs. I'm trying to guess what might be wrong. Thank you anyway for taking your time to write such detailed instructions, that's for sure the good starting point and it would probably work but some detail is missing. I will try to test it tomorrow on clean installation. |
Quote:
Alternatively you'd need to add the JOIN request to that query as well. |
Yes! It works now like a charm! Thank you! :)
So simple though I wouldn't figure it myself. Absolutely precious feature, at least for me. |
Is there something like this for 4.x.x? I'm looking for a thumbs up option. It should be standard in vbulletin by now. It's a popular feature all over the web.
|
Quote:
|
Quote:
|
All times are GMT. The time now is 08:20 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|