Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Topic started by: Sven17 on May 13, 2009, 08:43:17 AM

Title: how to make my topics to be generated alphabetical?
Post by: Sven17 on May 13, 2009, 08:43:17 AM
how to make my topics to be generated alphabetical?
e.g

A topic
B topic
C Topic

and not by the newest to older
for all users
Title: Re: how to make my topics to be generated alphabetical?
Post by: Kermit on May 13, 2009, 10:09:52 AM
Quote from: Sven17 on May 13, 2009, 08:43:17 AM
how to make my topics to be generated alphabetical?
e.g

A topic
B topic
C Topic

and not by the newest to older
for all users


To achieve both of them is not possible,also either you should sort them alphabetical or from the oldest to the newest

For an alphabetical sort,you can do this

in ./Sources/MessageIndex.php

Code (find) 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']);
}


Code (replace with) Select

// They didn't pick one, default to by last post descending.
if (!isset($_REQUEST['sort']) || !isset($sort_methods[$_REQUEST['sort']]))
{
$context['sort_by'] = 'subject';
$_REQUEST['sort'] = 'mf.subject';
$ascending = !isset($_REQUEST['desc']);
}






for the oldest to the newest

Code (find) 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']);
   }



Code (replace with) Select

   // They didn't pick one, default to by last post descending.
   if (!isset($_REQUEST['sort']) || !isset($sort_methods[$_REQUEST['sort']]))
{
$context['sort_by'] = 'first_post';
$_REQUEST['sort'] = 'ID_TOPIC';
$ascending = isset($_REQUEST['asc']);
}
Title: Re: how to make my topics to be generated alphabetical?
Post by: jossanaijr on May 13, 2009, 10:15:55 AM
Not exactly what you need but there is this mod:
http://custom.simplemachines.org/mods/index.php?mod=1459
Title: Re: how to make my topics to be generated alphabetical?
Post by: Sven17 on May 13, 2009, 10:49:36 AM
Quote from: Duncan85 on May 13, 2009, 10:09:52 AM

To achieve both of them is not possible,also either you should sort them alphabetical or from the oldest to the newest

For an alphabetical sort,you can do this

in ./Sources/MessageIndex.php

Code (find) 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']);
}


Code (replace with) Select

// They didn't pick one, default to by last post descending.
if (!isset($_REQUEST['sort']) || !isset($sort_methods[$_REQUEST['sort']]))
{
$context['sort_by'] = 'subject';
$_REQUEST['sort'] = 'mf.subject';
$ascending = !isset($_REQUEST['desc']);
}






for the oldest to the newest

Code (find) 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']);
   }



Code (replace with) Select

   // They didn't pick one, default to by last post descending.
   if (!isset($_REQUEST['sort']) || !isset($sort_methods[$_REQUEST['sort']]))
{
$context['sort_by'] = 'first_post';
$_REQUEST['sort'] = 'ID_TOPIC';
$ascending = isset($_REQUEST['asc']);
}

Thanks man that works,but it sorts them this way:

D
C
B
A

Can you make it

A
B
C
D

I tryed to change the 'desc' to 'asc' but it doesnt work
Title: Re: how to make my topics to be generated alphabetical?
Post by: Kermit on May 13, 2009, 10:53:33 AM
Try this

Code (find) Select

   // They didn't pick one, default to by last post descending.
   if (!isset($_REQUEST['sort']) || !isset($sort_methods[$_REQUEST['sort']]))
   {
      $context['sort_by'] = 'subject';
      $_REQUEST['sort'] = 'mf.subject';
      $ascending = !isset($_REQUEST['desc']);
   }


Code (replace with) Select

   // They didn't pick one, default to by last post descending.
   if (!isset($_REQUEST['sort']) || !isset($sort_methods[$_REQUEST['sort']]))
   {
      $context['sort_by'] = 'subject';
      $_REQUEST['sort'] = 'mf.subject';
      $ascending = isset($_REQUEST['asc']);
   }
Title: Re: how to make my topics to be generated alphabetical?
Post by: Sven17 on May 13, 2009, 12:17:05 PM
sorry but it doesnt work :/
Title: Re: how to make my topics to be generated alphabetical?
Post by: Kermit on May 13, 2009, 02:04:05 PM
Actually what i gave you here

http://www.simplemachines.org/community/index.php?topic=310175.msg2057761#msg2057761

should work,i've tested on my site and it works fine !
Title: Re: how to make my topics to be generated alphabetical?
Post by: Blinker on May 13, 2009, 07:30:18 PM
This mod allows you to sort alphabetically - http://custom.simplemachines.org/mods/index.php?mod=965

I can't remember if you can force a global setting, pretty sure it's user choice only but check it out.
Title: Re: how to make my topics to be generated alphabetical?
Post by: JBlaze on July 06, 2009, 06:51:46 PM
Sven17, is this issue now resolved?

Have you tried doing what Duncan85 suggested?