Advertisement:

Author Topic: Make a board always sorted by 'subject' as default  (Read 31479 times)

Offline easykey

  • Semi-Newbie
  • *
  • Posts: 31
  • Gender: Male
  • learning the ropes
    • easykey
Make a board always sorted by 'subject' as default
« on: September 11, 2004, 11:31:19 AM »
Is there a way I can sort the topics in one board in alphabetical order of subject?
(ignoring post date)
Is it something I modify in a theme template?

[edit] changed topic title [/edit]
« Last Edit: September 29, 2004, 02:26:17 AM by A.M.A »

Offline Tom

  • Full Member
  • ***
  • Posts: 565
  • Gender: Male
    • Pogo Cheats
Re: Sort topics by alphabetical order?
« Reply #1 on: September 11, 2004, 11:33:05 AM »
Just click on "Subject". :)

Offline easykey

  • Semi-Newbie
  • *
  • Posts: 31
  • Gender: Male
  • learning the ropes
    • easykey
Re: Sort topics by alphabetical order?
« Reply #2 on: September 11, 2004, 02:43:30 PM »
Sorry I should have been clearer.

Is there a way I can make one board particulalry open up always sorted by Subject as DEFAULT

(But other boards continue sorting by last post at the top)

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Sort topics by alphabetical order?
« Reply #3 on: September 11, 2004, 04:21:57 PM »
Currently, there is no option for the default sort of boards, but this is something I'd like to add either as a mod or feature.

What you could do is... find in Sources/MessageIndex.php:
Code: [Select]
// Make sure the starting place makes sense and construct the page index.
Add above it:
Code: [Select]
if (!isset($_REQUEST['sort']) && $board == BOARD ID HERE!!)
$_REQUEST['sort'] = 'subject';

Where BOARD ID HERE!! is the board, such as 11... (that's this board ;).)

-[Unknown]

Offline Anguz

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,430
  • Gender: Male
    • cristianlavaque.com
Re: Sort topics by alphabetical order?
« Reply #4 on: September 13, 2004, 12:39:36 AM »
I'd say this topic is a great candidate for the Tips and Tricks board.
Cristián Lávaque http://cristianlavaque.com

Offline Anguz

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,430
  • Gender: Male
    • cristianlavaque.com
Cristián Lávaque http://cristianlavaque.com

Offline NukeWorker.com

  • Full Member
  • ***
  • Posts: 416
  • Gender: Male
  • I love NukeWorker.com
    • Nuclear Jobs Pictures News
Re: Sort topics by alphabetical order?
« Reply #6 on: April 17, 2005, 04:32:00 PM »
Currently, there is no option for the default sort of boards, but this is something I'd like to add either as a mod or feature.

What you could do is... find in Sources/MessageIndex.php:
Code: [Select]
// Make sure the starting place makes sense and construct the page index.
Add above it:
Code: [Select]
if (!isset($_REQUEST['sort']) && $board == BOARD ID HERE!!)
$_REQUEST['sort'] = 'subject';

Where BOARD ID HERE!! is the board, such as 11... (that's this board ;).)

-[Unknown]

This would be a nice addition to SMF 1.1, I've been waiting for this to be an official part of the software for some time now.

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Make a board always sorted by 'subject' as default
« Reply #7 on: April 17, 2005, 04:33:45 PM »
Or you can use the Board Default Sort mod.

-[Unknown]

Offline NukeWorker.com

  • Full Member
  • ***
  • Posts: 416
  • Gender: Male
  • I love NukeWorker.com
    • Nuclear Jobs Pictures News
Re: Make a board always sorted by 'subject' as default
« Reply #8 on: April 17, 2005, 10:44:05 PM »
Does it work in 1.1?  I haven't installed any mods, cause I'm running 1.1 and I don't know what might work, and what might not.

Offline Anguz

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,430
  • Gender: Male
    • cristianlavaque.com
Re: Make a board always sorted by 'subject' as default
« Reply #9 on: April 17, 2005, 11:46:44 PM »
Does it work in 1.1?

Haven't checked yet, but maybe it does without changes other than the SMF version number.
« Last Edit: April 17, 2005, 11:48:49 PM by Anguz »
Cristián Lávaque http://cristianlavaque.com

Offline mank

  • Semi-Newbie
  • *
  • Posts: 31
Re: Make a board always sorted by 'subject' as default
« Reply #10 on: June 01, 2005, 04:45:53 PM »
i couldn't get it to work in beta 2...kept getting a b.sort file error, can't remember what it was exactly but it stopped all forum access :(

Offline onijin

  • Jr. Member
  • **
  • Posts: 132
  • Gender: Male
    • Forgotten Garden
Re: Sort topics by alphabetical order?
« Reply #11 on: March 18, 2006, 12:31:28 PM »
Currently, there is no option for the default sort of boards, but this is something I'd like to add either as a mod or feature.

What you could do is... find in Sources/MessageIndex.php:
Code: [Select]
// Make sure the starting place makes sense and construct the page index.
Add above it:
Code: [Select]
if (!isset($_REQUEST['sort']) && $board == BOARD ID HERE!!)
$_REQUEST['sort'] = 'subject';

Where BOARD ID HERE!! is the board, such as 11... (that's this board ;).)

-[Unknown]

Thanks for this.  I had the mod said above on 1.0.6 but I couldn't get it working with 1.1RC2.  This helps.  I'll try it out later.  However, I do have a question:
What if I wanted to do it on multiple boards?  Would I add this:
Code: [Select]
if (!isset($_REQUEST['sort']) && $board == BOARD ID HERE!!)
$_REQUEST['sort'] = 'subject';
For each board?  Or can I do this:
Code: [Select]
if (!isset($_REQUEST['sort']) && $board == 4, 5, 8, 11, 14)
$_REQUEST['sort'] = 'subject';
Just once?

Offline onijin

  • Jr. Member
  • **
  • Posts: 132
  • Gender: Male
    • Forgotten Garden
Re: Make a board always sorted by 'subject' as default
« Reply #12 on: March 21, 2006, 09:53:26 AM »
Nevermind.  After hours of searching, I found it.

Code: [Select]
if (!isset($_REQUEST['sort']) && $board == '17' || $board == '18' || $board == '27' || $board == '29')
$_REQUEST['sort'] = 'subject';

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 55,122
  • Gender: Male
    • Kindred-999 on GitHub
Re: Make a board always sorted by 'subject' as default
« Reply #13 on: March 21, 2006, 09:57:12 AM »
use proper coding...

Code: [Select]
if (!isset($_REQUEST['sort']) && ($board == '17' || $board == '18' || $board == '27' || $board == '29'))
$_REQUEST['sort'] = 'subject';

you should have an additional set of parens around the OR section...
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline onijin

  • Jr. Member
  • **
  • Posts: 132
  • Gender: Male
    • Forgotten Garden
Re: Make a board always sorted by 'subject' as default
« Reply #14 on: March 21, 2006, 02:25:07 PM »
<-- newb

Elaborate please...

"or"?

Offline jpark

  • Semi-Newbie
  • *
  • Posts: 17
Re: Make a board always sorted by 'subject' as default
« Reply #15 on: May 22, 2006, 01:46:32 AM »
hi, how would I sort by the date of the topic in descending order.  In other words use 'first_post' instead of 'subject' but have the newest topic up at the top?

Also, if I would like this to be the default sort on all of the boards (not just a select few), would I use this code or change the code elsewhere?

Thanks~! :)
« Last Edit: May 22, 2006, 01:49:37 AM by jpark »

Offline onijin

  • Jr. Member
  • **
  • Posts: 132
  • Gender: Male
    • Forgotten Garden
Re: Make a board always sorted by 'subject' as default
« Reply #16 on: May 22, 2006, 08:51:20 AM »
hi, how would I sort by the date of the topic in descending order.  In other words use 'first_post' instead of 'subject' but have the newest topic up at the top?

Isn't this the default, where the newest topics are listed at top?

Offline jpark

  • Semi-Newbie
  • *
  • Posts: 17
Re: Make a board always sorted by 'subject' as default
« Reply #17 on: May 22, 2006, 11:39:24 AM »
i think the default is set to the topic with the newest post up top.. i would like to sort by the original topic date (first post) regardless of the date of the last post.  I hope this is not hijacking.. if there is one simple default sort function addressing anyone's sorting wishes, that would be wonderful!  Thanks~  :)
« Last Edit: May 22, 2006, 11:43:26 AM by jpark »

Offline onijin

  • Jr. Member
  • **
  • Posts: 132
  • Gender: Male
    • Forgotten Garden
Re: Make a board always sorted by 'subject' as default
« Reply #18 on: May 22, 2006, 12:08:06 PM »
Oh~

Sort by Opening Posts... hmm~  I don't know...

Sorry~

Offline jpark

  • Semi-Newbie
  • *
  • Posts: 17
Re: Make a board always sorted by 'subject' as default
« Reply #19 on: May 22, 2006, 08:08:27 PM »
oh.. i think i figured it out (it works at least) but i don't know if the coding is right..
I went to messageindex.php in sources and found:
Code: [Select]
// They didn't pick one, default to by last post descending.
if (!isset($_REQUEST['sort']) || !isset($sort_methods[$_REQUEST['sort']]))
{
$context['sort_by'] = 'last_post';
$_REQUEST['sort'] = 'ID_LAST_MSG';
$ascending = isset($_REQUEST['asc']);
}

and changed it to:
Code: [Select]
// They didn't pick one, default to by first post descending.
if (!isset($_REQUEST['sort']) || !isset($sort_methods[$_REQUEST['sort']]))
{
$context['sort_by'] = 'first_post';
$_REQUEST['sort'] = 'ID_TOPIC';
$ascending = isset($_REQUEST['desc']);
}

can anyone tell me if this is correct?