MyBB Community Forums

Full Version: Is there a way to change order of threads?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When opening a forum, threads are ordered by last post, or you can change to creation time, alphabetically, etc.

However, there is no option that I see to make "hot" or "rising" threads go to the top, sorta like reddit does.

Is there a way to do that? If using the like system of mybb, could most upvoted threads go to the top?

If there is none, could someone tell me where to create such a filter? (And how, if possible)
You would need a plugin to accomplish this, there is no method in the default MyBB core to automatically sticky or raise 'hot threads' in the thread display list. Smile
(2017-11-27, 03:38 PM)kawaii Wrote: [ -> ]You would need a plugin to accomplish this, there is no method in the default MyBB core to automatically sticky or raise 'hot threads' in the thread display list. Smile

Yes, i imagined so, but I also found no plugins.

If I were to do it myself, where are the queries for this displayed? Any suggestions as for what to do?
You can change default "sort by" option by changing some core files.

You can sort threads by reputation. That is those 5 stars at the right of thread name...

Check it if that is what you need, but then threads will be sorted by average rating. And right now, as I know there is no something like "hot" option... You mean most views or most posts? That can be done too... Or something else?

If you want to make default sort of threads by rating, do next:
Open forumdisplay.php in root of your forum. Than find this:

switch($mybb->input['sortby'])
{
	case "subject":
		$sortfield = "subject";
		break;
	case "replies":
		$sortfield = "replies";
		break;
	case "views":
		$sortfield = "views";
		break;
	case "starter":
		$sortfield = "username";
		break;
	case "rating":
		$t = "";
		$sortfield = "averagerating";
		$sortfield2 = ", t.totalratings DESC";
		break;
	case "started":
		$sortfield = "dateline";
		break;
	default:
		$sortby = "lastpost";
		$sortfield = "lastpost";
		$mybb->input['sortby'] = "lastpost";
		break;
}


And replace with this for defalt sorting by rating for example:

switch($mybb->input['sortby'])
{
	case "subject":
		$sortfield = "subject";
		break;
	case "replies":
		$sortfield = "replies";
		break;
	case "views":
		$sortfield = "views";
		break;
	case "starter":
		$sortfield = "username";
		break;
	case "started":
		$sortfield = "dateline";
		break;
    case "lastpost":
        $sortfield = "lastpost";
        break;
	default:
		$sortby = "rating";
        $t = "";
		$sortfield = "averagerating";
        $sortfield2 = ", t.totalratings DESC";
		$mybb->input['sortby'] = "rating";
		break;
}
(2017-11-27, 05:12 PM)Ikerepc Wrote: [ -> ]You can change default "sort by" option by changing some core files.

You can sort threads by reputation. That is those 5 stars at the right of thread name...

Check it if that is what you need, but then threads will be sorted by average rating. And right now, as I know there is no something like "hot" option... You mean most views or most posts? That can be done too... Or something else?

If you want to make default sort of threads by rating, do next:
Open forumdisplay.php in root of your forum. Than find this:

switch($mybb->input['sortby'])
{
	case "subject":
		$sortfield = "subject";
		break;
	case "replies":
		$sortfield = "replies";
		break;
	case "views":
		$sortfield = "views";
		break;
	case "starter":
		$sortfield = "username";
		break;
	case "rating":
		$t = "";
		$sortfield = "averagerating";
		$sortfield2 = ", t.totalratings DESC";
		break;
	case "started":
		$sortfield = "dateline";
		break;
	default:
		$sortby = "lastpost";
		$sortfield = "lastpost";
		$mybb->input['sortby'] = "lastpost";
		break;
}


And replace with this for defalt sorting by rating for example:

switch($mybb->input['sortby'])
{
	case "subject":
		$sortfield = "subject";
		break;
	case "replies":
		$sortfield = "replies";
		break;
	case "views":
		$sortfield = "views";
		break;
	case "starter":
		$sortfield = "username";
		break;
	case "started":
		$sortfield = "dateline";
		break;
    case "lastpost":
        $sortfield = "lastpost";
        break;
	default:
		$sortby = "rating";
        $t = "";
		$sortfield = "averagerating";
        $sortfield2 = ", t.totalratings DESC";
		$mybb->input['sortby'] = "rating";
		break;
}
Thanks! That's really useful.

I may be asking too much, but would it be possible to leave all "hot" threads first and then the rest of threads (both ordered with the default last reply filter)?

Like this. Order:
-All threads marked as hot (ordered by default "last post" order)
-All threads that are NOT hot (ordered by default "last post" order)

I want to make it reddit-like, but obviously that's not possible. I think if i see the code for the above I would be able to make the rest of modifcations myself.

Thanks in any case.
So, you want separated hot and normal threads, both sorted by last post, right?

If yes, do you want all hot threads first, sorted by last post, than right after that all not hot threads sorted by last post?

And there are other options for sorting? If yes, They work at same way like this: first hot than others or normally?

What do you consider by "hot"? Than maybe I can create some code for that...
(2017-11-27, 05:35 PM)Ikerepc Wrote: [ -> ]So, you want separated hot and normal threads, both sorted by last post, right?

If yes, do you want all hot threads first, sorted by last post, than right after that all not hot threads sorted by last post?

And there are other options for sorting? If yes, They work at same way like this: first hot than others or normally?

What do you consider by "hot"?  Than maybe I can create some code for that...
Hi! Sorry the delay, i was actually considering very seriously what i'd like overall.

I know i'm being very picky, but if you want to know exactly what i want:

1) First threads that are LESS than 1 day old (created during the last 1 day), ordered by last post.

2) After all those threads from 1), i want all other threads (that are older than 1 day), ordered as well by last post.

Thanks!
Sorry, but that require some new functions... I'd recommend some plugin for that as that is not one of default forum options...

Maybe you can request one on this forum or something? Cause I can try to do that but I'm not sure how long it will take and if I can make that Big Grin