in the new version is global default set of sorting photos to descending. If I change the settings to ascending and save, settings are not saved, restore descending (btw in the node setting is it functional).


Hello djs_core,

I have commited the fix to the dev. In case you want better use a patch, here the link to them.

Regards and thanks
Juan Carlos

Version:6.x-1.17» 6.x-1.18

change items order (numerically or per drag) has no effect! Also has no effect changing sort order (asc / desc).
The numeric value of the item order can be save without effect to the image order of the gallery.

GA 6.x-1.18 // GAL 6.x-1.4 // GAic 6.x-1.2 || D 6.19

me too I'm having this problem. I'm not sure when it started, maybe while I was trying to figure out how to make "public to all" back again all my galleries. I overridden severla options, then reverted.
Also manually changing values on db, doesn't help. Those values are ok, after all. So where the error comes from?

I found the problem. This is the query with the wrong "ORDER BY" statement:
SELECT a.pid, a.nid, a.ref, a.gid, a.gref, a.sid, a.uid, a.fid, a.filename, a.opath, a.ppath, a.tpath, a.copyright, a.weight, a.cover, a.aid, f.timestamp, tp.lang, tp.ptitle, tp.palt, tp.pdescription, tp.format, tp.did FROM gallery_assist_item a JOIN gallery_assist_translated tp ON a.pid = tp.pid JOIN files f ON f.fid = a.fid WHERE a.gref=28 AND tp.lang = 'it' ORDER BY a.cover DESC, a.weight ASC

I changed
    $query .= " ORDER BY a.cover DESC, {$ga_db_order_field} {$ga_db_order}";

    $query .= " ORDER BY {$ga_db_order_field} {$ga_db_order}";

I suppose "a.cover" is an album cover, but I have no albums. I have galleries assigned to nodes, so I have no covers.
I don't know if my modification would break standalone galleries.



"a" is an alias from table "gallery_assist_item". a.cover is the boolean value which that flag a image as cover.
If you remove a.cover, the cover images in your galleries will are not more the first image in the image order.
I am sure this Problem is in other place and I will solve it in the next time so far I can.

Juan Carlos

Hi jcmc,
thanks for your reply.
I found that problem after I upgraded from 1.15 to 1.18.
In 1.15 that query is different (see ORDER BY at gallery_assist.module:1661):

    $query = "SELECT a.pid, a.nid, a.ref, a.gid, a.gref, a.sid, a.uid, a.fid, a.filename, a.opath,
    a.ppath, a.tpath, a.copyright, a.weight, a.cover, f.timestamp, tp.lang, tp.ptitle, tp.palt, tp.pdescription, tp.format,
    tp.did FROM {gallery_assist_item} a JOIN {gallery_assist_translated} tp ON a.pid = tp.pid
    JOIN {files} f ON f.fid = a.fid
    WHERE a.gref=%d AND tp.lang = '%s'";
    $query .= " ORDER BY ". $udata['ga_db_order_field'];
    $query .= " ". $udata['ga_db_order'];

Priority:Normal» Major

Same problem here. Even only upgrading to 1.18 changed my existing galleries photos' order and they can no longer be resaved in the correct order :-(

Having this issue too, 1.18.

Hi Juan Carlos,

the bug is still on in the dev version from Nov 27th :-(
Would be great if you find it. Thx!

Greetings, 4ud

and is also in the version: gallery_assist-6.x-1.19-beta2


Category:bug» task

Any news regarding the items order problem? I also have that issue (on 1.18) and would be great if it could be solved!!

Is this being addressed in the upcoming 1.19?

same issue, can not reorder photos. I've updated to 6.x-1.19beta5 and still have the same issue.

The weird thing is that this has already been working but then was broken again. I guess this should be easy to fix.

I could not find where to fix this in gallery_assist.module so I made this change to the display templates :

  • gallery_assist_display.inc.php
  • gallery_assist_list_display.inc.php
  • gallery_assist_lightboxes_display.inc.php (in gallery_assist_lightboxes module)
  • gallery_assist_lightboxes_list_display.inc.php (also in gallery_assist_lightboxes module)

In the gallery_assist_display function (top of the file), right after :

  if (count($node->gallitems) == 0) {

I added a sort on the gallery items array :
  usort($node->gallitems, function($a, $b) {
  $wa = $a->weight;
  $wb = $b->weight;
  if ($wa == $wb) {
  return 0;
  return ($wa < $wb)? -1 : 1;

This is definitely not the best place to have a data sort but it did the trick for me pending a bug fix.

My previous code generates a parse error with PHP < 5.3. To fix that, move the sort function outside gallery_assist_display ; i.e. place this code before function gallery_assist_display :

* Helper function, for sorting gallery items array by weight.
* See http://drupal.org/node/963238
function gallery_assist_display_sort_items($a, $b) {
  $wa = $a->weight;
  $wb = $b->weight;
  if ($wa == $wb) {
  return 0;
  return ($wa < $wb)? -1 : 1;

and the code inside gallery_assist_display becomes :

usort($node->gallitems, gallery_assist_display_sort_items);

Version:6.x-1.18» 6.x-1.19-beta5

Is it possible to fix this issue?

Please what is the recommended fix for this cumbersome problem?If you have a gallery node with images distributed over more than one pages, the ascending file name ordering does not work properly. The first item is wrong.

Is this module still maintained?

Version:6.x-1.19-beta5» 6.x-1.18

Having the same issue. Changing the weight of images does not seem to do anything. Ideally it would be awesome if you could include drop and drag functionality and order the images in that way. Well if anyone has found a solution please post!

Version:6.x-1.18» 6.x-1.19-beta5

That has already worked in a past version, so the solution should be known. The problem exists both in 6.x-1.18 and 6.x-1.19-beta5, so please keep the affected version on the latest one.

The fix submitted by nicolascuny works fine for the grid view but the pager links in the item view still bring up the wrong picture. Judging by the duration of this issue I'm guessing this won't get fixed. Too bad, I had hoped to use this module.

The module author recently showed some activity in Git (for a D7 version), after being silence for many months. So there is a hope he will look at this issue some day and fix it...

Too bad this bug is discuss here for a one and half year and still not found a solution. I wrote jcmc if he see a solution in the near future? No answer yet... So that we can only wait and hope.

Version:6.x-1.19-beta5» 6.x-1.18
Priority:Major» Normal

Hello friends,
No solution to this problem of order?
I set the files manually to get the order.

thank you

Version:6.x-1.18» 6.x-1.19-beta5
Category:task» bug
Priority:Normal» Major

Why did you change the affected Version and Priority?

The bug described above is in version 6.x-1.19-beta5... jcmc added last post in 2010 :) He did not answer to my e-mail questions about this bug. I think we will be waiting a couple of year to solve this... Who is on start with new web project, I recommend choice another module for Gallery... This one is nice and easy, but bad support.

Hello people,
for the first excuse me for the big big delayed reaction.

the setting "ga_db_order_field" was missed by the node update hook.
I have to get newly the overview, to many time in other non Drupal projects.


commited to the dev version.

I not see where I can change the status to needs review.

Status:Active» Needs review


Status:Needs review» Fixed

Thank you for that commit! I can confirm that Gallery Assist to 6.x-1.19-beta5+34-dev (2012-Sep-05) has fixed this bug. Could you please release 6.x-1.19-beta6 or 6.x-1.19 final? Seems to work fine so far.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Title:Items order cannot be changedItems order cannot be changed - fixed in 6.x-1.19-beta6?
Status:Closed (fixed)» Active

May I ask to have 6.x-1.19-beta6 released so we won't have to use 6.x-1.19-beta5+34-dev (2012-Sep-05)?