Custom Sort Order of Image Custom Sort Order of Image
 

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

Main Menu

Custom Sort Order of Image

Started by Singular, October 03, 2012, 02:46:28 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Singular

Hello all,

I used a Coppermine developer to help me with my gallery customizations of the last few years. I have not been able to contact him recently and need some help. One of the things that needs to be fixed is the sort order of images on the thumnail page. The way I need it to work is that the images in the users' personal galleries are ordered by sort order, then by date uploaded desc. I need the images in the public galleries to be displayed in order by newest, all the time. The public galleries can not be uploaded directly to. Users can upload to their personal gallery and to contest albums. They have the option to select public albums to be included to. That is a mod that my developer added for me. It is another way of linking to additional albums. So the public galleries include all images that were included from users' personal albums. Some of the images in those albums have been sorted in the personal albums. However, that should not affect the order that they are displayed in the public albums. Like I said above, images in public galleries should always be displayed by newest first. Currently, the sort order in the personal galleries is not displaying correctly.

Can anyone please help me? Not sure if a function has to be written to do this. I would really appreciate any assistance. Will pay if needed because of time involved.

all the best,
Joe

http://www.asingularcreation.com/Gallery/

Jeff Bailey

I'm not positive what you are asking for.
This will make the personal galleries show date descending, public galleries date ascending and will remove sort options.

In thumbnails.php
Find

    //show sort options only when not a meta album
    $js_sort_vars = array(
        'aid'           => $album,
        'page'          => $page,
        'sort_name'     => $lang_thumb_view['name'],
        'sort_title'    => $lang_common['title'],
        'sort_date'     => $lang_thumb_view['date'],
        'sort_position' => $lang_thumb_view['position'],
        'sort_ta'       => $lang_thumb_view['sort_ta'],
        'sort_td'       => $lang_thumb_view['sort_td'],
        'sort_na'       => $lang_thumb_view['sort_na'],
        'sort_nd'       => $lang_thumb_view['sort_nd'],
        'sort_da'       => $lang_thumb_view['sort_da'],
        'sort_dd'       => $lang_thumb_view['sort_dd'],
        'sort_pa'       => $lang_thumb_view['sort_pa'],
        'sort_pd'       => $lang_thumb_view['sort_pd']
    );
   
    set_js_var('sort_vars', $js_sort_vars);
    js_include('js/thumbnails.js');

Replace with

    if ($actual_cat > 10000) {
        $USER['sort'] = 'dd';
    } else {
        $USER['sort'] = 'da';
    }

    //show sort options only when not a meta album
    /*$js_sort_vars = array(
        'aid'           => $album,
        'page'          => $page,
        'sort_name'     => $lang_thumb_view['name'],
        'sort_title'    => $lang_common['title'],
        'sort_date'     => $lang_thumb_view['date'],
        'sort_position' => $lang_thumb_view['position'],
        'sort_ta'       => $lang_thumb_view['sort_ta'],
        'sort_td'       => $lang_thumb_view['sort_td'],
        'sort_na'       => $lang_thumb_view['sort_na'],
        'sort_nd'       => $lang_thumb_view['sort_nd'],
        'sort_da'       => $lang_thumb_view['sort_da'],
        'sort_dd'       => $lang_thumb_view['sort_dd'],
        'sort_pa'       => $lang_thumb_view['sort_pa'],
        'sort_pd'       => $lang_thumb_view['sort_pd']
    );
   
    set_js_var('sort_vars', $js_sort_vars);
    js_include('js/thumbnails.js');*/
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

Singular

Thanks so much for your reply. I appreciate your time. I should be more precise in what I am asking. I don't want there to be any sort options for the viewer. I want the images in the personal albums to always be ordered by sort order (the same way they are displayed in picmgr.php), then date descending. I wan't the images in the public galleries to always be ordered by date descending (newest first).

I hope that makes sense.

all the best,
Joe

Jeff Bailey

The code I posted removes the sortorder options and forces it to what you set in the if statement.

Change the dd to pa, the da to dd and make sure Default sort order for files is set to date descending.


    $CONFIG['default_sort_order'] = 'dd';
    if ($actual_cat > 10000) {
        $USER['sort'] = 'pa';
    } else {
        $USER['sort'] = 'dd';
    }

    //show sort options only when not a meta album
    /*$js_sort_vars = array(
        'aid'           => $album,
        'page'          => $page,
        'sort_name'     => $lang_thumb_view['name'],
        'sort_title'    => $lang_common['title'],
        'sort_date'     => $lang_thumb_view['date'],
        'sort_position' => $lang_thumb_view['position'],
        'sort_ta'       => $lang_thumb_view['sort_ta'],
        'sort_td'       => $lang_thumb_view['sort_td'],
        'sort_na'       => $lang_thumb_view['sort_na'],
        'sort_nd'       => $lang_thumb_view['sort_nd'],
        'sort_da'       => $lang_thumb_view['sort_da'],
        'sort_dd'       => $lang_thumb_view['sort_dd'],
        'sort_pa'       => $lang_thumb_view['sort_pa'],
        'sort_pd'       => $lang_thumb_view['sort_pd']
    );
   
    set_js_var('sort_vars', $js_sort_vars);
    js_include('js/thumbnails.js');*/
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

Singular

Thanks again. I tried what you recommended but it did not work. I think that there was probably a function written for my request that handled all of my gallery's customizations. I may have to hire someone to look at it, if I can not get a hold of Stramm.

Thanks again for your time.

To Stramm: If you see this post, could you please contact me. I would appreciate if you could let me know if you are or are not available any longer.

all the best,
Joe

ΑndrĂ©

As Jeff's mod should work on stock Coppermine galleries, there's probably something that overwrites that code. Without knowing those modifications it's not possible to fix anything. However, Stramm still visits this board from time to time, so maybe he replies to this thread.

Singular

Thanks again for your reply. Stramm did email me and will be able to help me soon. I appreciate you guys taking the time to try to help me. Keep up the outstanding work.

all the best,
Joe