Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Sorting albums by date created  (Read 3370 times)

0 Members and 1 Guest are viewing this topic.

Alexanderlejuez

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Sorting albums by date created
« on: March 11, 2014, 03:12:54 pm »

Hi all,

I am using coppermine version 1.5.18 and I have no categories created. I have all my albums in "no category". At the moment it is sorting albums from old to new. What I want is for it to sort by date created. I want the new albums to display first. I have searched on the forum and found the following:

Open index.php, find
Code: [Select]
ORDER BY a.pos, a.aidand replace with
Code: [Select]
ORDER BY a.aid(three times) to sort albums by date created.

I tried this, but is is still not working form me. I see no change.

Please advise. All help is appreciated.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Sorting albums by date created
« Reply #1 on: March 11, 2014, 03:33:05 pm »

At first you should upgrade to the latest stable release (currently cpg1.5.26), as you're running a version with known security vulnerabilities.

Then, please post a link to your gallery, so we can have a closer look.
Logged

Alexanderlejuez

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: Sorting albums by date created
« Reply #2 on: March 11, 2014, 04:41:33 pm »

Thank you for your prompt reply. I have just finished updating to 1.5.26

Please find my link to my album below:

http://www.afmaruba.com/album

I hope you can help me to find a solution for the ordering.

With kind regards,


Alexander Lejuez
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Sorting albums by date created
« Reply #3 on: March 11, 2014, 04:44:44 pm »

The mod seems to work as expected, the albums are displayed in ascending order.
Logged

Alexanderlejuez

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: Sorting albums by date created
« Reply #4 on: March 11, 2014, 04:55:39 pm »

Yes, but I want it to display the most recent albums first. As in Descending by date. Is this possible?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Sorting albums by date created
« Reply #5 on: March 11, 2014, 04:57:51 pm »

Sure, change
Code: [Select]
ORDER BY a.aidto
Code: [Select]
ORDER BY a.aid DESC
Logged

Alexanderlejuez

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: Sorting albums by date created
« Reply #6 on: March 11, 2014, 06:18:36 pm »

Thanks for the amazing response time. This did solve my problem. Many thanks  ;D
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Sorting albums by date created
« Reply #7 on: March 12, 2014, 01:43:30 pm »

I wonder where you found that code part, as I cannot see any occurrence of
Code: [Select]
ORDER BY a.pos, a.aidin the cpg1.5.26 version of index.php.

Instead, I found
Code: [Select]
        $sort_array = array(
            'ta' => "a.title ASC, a.aid ASC",
            'td' => "a.title DESC, a.aid DESC",
            'da' => "a.aid ASC",
            'dd' => "a.aid DESC",
            'pa' => "a.pos ASC, a.aid ASC",
            'pd' => "a.pos DESC, a.aid DESC",
        );
        //$sort_code  = isset($USER['sort'])? $USER['sort'] : $CONFIG['album_sort_order'];
        //$sort_order = isset($sort_array[$sort_code]) ? $sort_array[$sort_code] : $sort_array[$CONFIG['album_sort_order']];
        $sort_order = $sort_array[$CONFIG['album_sort_order']];
so I suggest to adjust the config value to your needs. It will save you the effort to re-apply the mod after each upgrade.

Unfortunately there's currently no configuration interface available, so you either need to adjust the value in your MySQL database with a tool like phpMyAdmin, or wait for the release of my "hidden features" plugin.

To change the sort order of albums, you can use the Hidden features plugin.
« Last Edit: March 12, 2014, 04:59:35 pm by Αndré »
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 20 queries.