Blorner

Friday, November 27, 2009

Wordpress Plugin NextGEN Gallery Sorting Bugfix

The changing the sort options of Wordpress plugin "NextGEN Gallery" doesn't affect on the images of the gallery sorted by tags. To fix the bug, do the following changes in nextgen-gallery\lib\ngg-db.php

set

// Check for the exclude setting

$ngg_options = get_option('ngg_options');
$gal_sort = $ngg_options['galSort'];
$gal_sort_dir = $ngg_options['galSortDir'];

if ( $gal_sort_dir == 'RAND' ) {
$order_clause = 'ORDER BY rand() ';
} elseif ( $gal_sort_dir == 'DESC' ) {
$order_clause = ' ORDER BY t.'.$gal_sort.' DESC';
} else {
$order_clause = ' ORDER BY t.'.$gal_sort.' ASC';
}


instead of

// Check for the exclude setting


$order_clause = ($order == 'RAND') ? 'ORDER BY rand() ' : ' ORDER BY t.pid ASC' ;

in the function find_images_in_list.

Getting the sort options from the database that is set in this function for not affecting on the work of other functions.

No comments:

Post a Comment

Art Works Expo