MyBB Community Forums

Full Version: How To Sort By Thread Prefixes Using XThreads
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone, today I'll be showing you how to have a sort by thread prefixes system for threads using XThreads. I think I might have found this method from another tutorial but can't find it or remember. I also got this idea from TheTechGame.com because that's how they sort threads.

Preview
[Image: j8Jo4hk.png]

Start off by downloading the XThreads plugin and installing it and activating it. Now go to Templates & Styles -> Themes -> * Your Theme * -> global.css and add the following code:

.thread-prefix-label {
    display: inline-block;
    font-family: 'Roboto Condensed', Arial,Verdana,Tahoma;
    font-weight: 700;
    font-size: 13px;
    background-color: #147BDB;
    color: #fff;
    padding: 0px 5px 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    margin-bottom: 3px;
    height: 23px;
}

Keep this tab open because you will need to go back to it later to add different colors to the prefixes.

For now go to Configurations -> Thread Prefixes -> Add New Thread Prefix then enter the name and in the "Display Style" enter this code:

<div class="thread-prefix-label thread-prefix-X">* Prefix Name *</div>

You will need to change the "X" in the url with the prefix ID so just save it, hover over the prefix name and get the ID now go back and change "X" with the ID and save. You will need to repeat this process for each prefix.

Once done go to Forums & Posts -> Forum Management -> * Your Forum * -> Edit Forum Settings then keep going down till you find "Forum Rules" and set the display method to "Display rules for this forum on the thread listing" and set the title to something like "Sort By Prefix" and now go to "Rules" and enter the following code:

<div class="thread-prefix-list">
<a href="?filterxt_prefix=X" class="thread-prefix-label thread-prefix-X mr" style="color:#fff;">* Prefix Name *</a> <a href="?filterxt_prefix=X" class="thread-prefix-label thread-prefix-X mr" style="color:#fff;">* Prefix Name *</a>
</div>

You will need to have the forum prefix made to get the ID. You can get the ID by hovering over the name in the admin cp and looking at the url. Now replace the "X" part of the url in the code above with the ID and keep repeating the same code but always replace "X" with the prefix ID with the prefix you have enabled for that forum and save. Remember the ID because that will be used for styling the prefix.

Example:
<a href="?filterxt_prefix=1" class="thread-prefix-label thread-prefix-1 mr" style="color:#fff;">TEST</a> <a href="?filterxt_prefix=2" class="thread-prefix-label thread-prefix-2 mr" style="color:#fff;">TEST 2</a>

You will need to enter the name of the prefix you want so make sure your name matches the prefix's ID you want.

Now go back to "global.css" and add the following code:

.thread-prefix-X {
	color: #fff;
	background-color: #005057;
}

You would need to copy and paste the code for each prefix and replacing "X" with the ID of the prefix and set the background color by changing the value of "background-color" and save.

Example:

.thread-prefix-1 {
	color: #fff;
	background-color: #005057;
}

.thread-prefix-2 {
	color: #fff;
	background-color: #0000FF;
}

I hope this tutorial helps everyone and sorry for the bad formatting don't really have time right now to fix it. Anyways thanks for reading and have a great day!
Hi, thank you for your contribution Smile

Please note that filtering by prefix is also possible within the core (adds a filter select in the filter form below thread list):
https://community.mybb.com/forum-38.html?prefix=11

Perhaps you can update your tutorial to be more general and thus useful to more users.
(2021-02-08, 11:40 PM)Omar G. Wrote: [ -> ]Hi, thank you for your contribution Smile

Please note that filtering by prefix is also possible within the core (adds a filter select in the filter form below thread list):
https://community.mybb.com/forum-38.html?prefix=11

Perhaps you can update your tutorial to be more general and thus useful to more users.

Oh wow didn’t know this was a core feature when was it added? I guess im just used to ways that I know work for me but thought I’ll share just so people know. Thanks for your response!
Sure, I won't be sure how long it has been a core feature, but since xThreads has it I'd assume it wasn't a core feature back when Yumi add it to his plugin.
(2021-02-09, 09:56 AM)mujeebdgk Wrote: [ -> ]another way is

https://mybb.group/Thread-Add-filtering-...hread-page

seriously 😂 , This is what you understand ?
(2021-02-09, 10:09 AM)PARADOXP Wrote: [ -> ]
(2021-02-09, 09:56 AM)mujeebdgk Wrote: [ -> ]another way is

https://mybb.group/Thread-Add-filtering-...hread-page

seriously 😂 , This is what you understand ?

 is not it is about sort thread by prefixes ?
(2021-02-10, 05:32 AM)mujeebdgk Wrote: [ -> ]
(2021-02-09, 10:09 AM)PARADOXP Wrote: [ -> ]
(2021-02-09, 09:56 AM)mujeebdgk Wrote: [ -> ]another way is

https://mybb.group/Thread-Add-filtering-...hread-page

seriously 😂 , This is what you understand ?

 is not it is about sort thread by prefixes ?

it is about clickable prefix that comes before the threads name , and results will be a list of threads that using the prefix , but here is the topic is about the lists of prefixes in forumdisplay_threadlist . I hope you understand what i am trying to say.