Thanks Imagely but that does not solve my issue, i now see that the same issue was already mentioned before in this thread: https://www.ads-software.com/support/topic/gallery-sort-order-adding-gallerie-picture/
I found an alternative way to get my desired alphabetically sorted drop-down lists when adding images to posts and when selecting galleries to upload images to, as i have so many galleries it greatly improves my workflow to have the dropdowns sorted alphabetically instead of by gallery ID.
What i did was switch to “NextCellent Gallery – NextGEN Legacy” (https://www.ads-software.com/plugins/nextcellent-gallery-nextgen-legacy/) which basicaly is a continuation of the NextGEN Gallery version 1.9.13 code. I got current version 1.9.35 running without problems on PHP 7.0.26. It also found all my excisting NextGEN Gallery galleries.
To get the alphabetically sorted drop-downs i made following edits:
in admin/class-ngg-adder.php:
line 133 from:
'galleries' => $nggdb->find_all_galleries('gid', 'DESC'),
----------- to -------------------->
'galleries' => $nggdb->find_all_galleries('title', 'ASC'),
and line 579 from: (leave this unchanged when you want to keep the display of the gallery ID ("123 - Gallery Name"))
echo '<option value="' . $gallery->gid . '" >' . $gallery->gid . ' - ' . esc_attr( $name ) . '</option>';
----------- to -------------------->
echo '<option value="' . $gallery->gid . '" >' . esc_attr( $name ) . '</option>';
in admin/media-upload.php:
line 170 from:
$gallerylist = $nggdb->find_all_galleries();
----------- to -------------------->
$gallerylist = $nggdb->find_all_galleries('title', 'ASC');
A final edit i made when after a image upload the “Edit gallery” link was not displayed, to get that fixed for me i edited:
in admin/functions.php:
line 298 from:
//TODO:Message will not shown, because AJAX routine require more time, message should be passed to AJAX
$message = $created_msg;
if ( count($updated) > 0)
$message .= $c . __(' picture(s) successfully renamed','nggallery') . '<br />';
if ( count($image_ids) > 0 )
$message .= count($image_ids) .__(' picture(s) successfully added','nggallery') . '<br />';
if ($created_msg) {
$message .= ' [<a href="' . admin_url() . 'admin.php?page=nggallery-manage&mode=image&gid=' . $gallery_id . '" >';
$message .= __('Edit gallery','nggallery');
$message .= '</a>]';
}
if (!$message)
$message = __('No images were added.','nggallery');
nggGallery::show_message($message);
----------- to -------------------->>>>
//TODO:Message will not shown, because AJAX routine require more time, message should be passed to AJAX
$message = $created_msg . count($image_ids) .__(' picture(s) successfully added','nggallery');
$message .= ' [<a href="' . admin_url() . 'admin.php?page=nggallery-manage&mode=image&gid=' . $gallery_id . '" >';
$message .= __('Edit gallery','nggallery');
$message .= '</a>]';
nggGallery::show_message($message);
Of course not a perfect approach as the edits will be lost when the plugin gets updated, then you will have to see if the edits still will work and can be repeated. So not pretty but it makes my workflow so much easier that for me its worthwhile.
Note on running “NextCellent Gallery – NextGEN Legacy” alongside “NextGEN Gallery”:
https://www.ads-software.com/plugins/nextcellent-gallery-nextgen-legacy/#installation
Remember: plugin won’t activate if NextGEN is installed and activated. A message will remind you this situation. Please deactivate any NextGEN plugin before installing NextCellent.
Be save when experimenting, back up your database and galleries first.