Recently I found myself in that very anoying situation where a very good piece of software seemed to lack just this one function… again. I have been doing a gallery website and used the NextGen gallery plugin to display the photos. Unfortunatelly it was a case of a gallery per post with about 1 or 2 photos per gallery.
The biggest issue with this setting was the process of creating galleries. By default in NextGen you create the gallery on one page, upload the images in another, and then create new post yet elsewhere. But there had to be a way to at least merge the gallery creation with photo upload, especially considering a new gallery form consisted of a single “gallery name” field.Surprisingly enough after checking the code, both actions are actually processed in the same place. Thus by adding a new field on the photo upload form this time consuming problem could be solved:
Edit the file: wp-content/plugins/nggallery/admin/wp25/addgallery.php (line: 15)
// link for the flash file $swf_upload_link = NGGALLERY_URLPATH . 'admin/wp25/upload.php'; $swf_upload_link = wp_nonce_url($swf_upload_link, 'ngg_swfupload'); //flash doesn't seem to like encoded ampersands, so convert them back here $swf_upload_link = str_replace('&', '&', $swf_upload_link); $defaultpath = $ngg_options['gallerypath']; if ($_POST['addgallery']** || !empty($_POST['newgalleryname'])**){ if(!empty($_POST['newgalleryname'])) $_POST['galleryname'] = $_POST['newgalleryname']; check_admin_referer('ngg_addgallery'); $newgallery = attribute_escape($_POST['galleryname']); if (!empty($newgallery)) **$_POST['galleryselect'] = **nggAdmin::create_gallery($newgallery, $defaultpath); } if ($_POST['zipupload']){
Edit the file: wp-content/plugins/nggallery/admin/wp25/addgallery.php (line: 263)
" . ini_get('upload_max_filesize') . "Byten"; ?>
Edit the file: wp-content/plugins/nggallery/admin/wp25/functions.php (line: 77)
if ($result) { nggallery::show_error(('Gallery', 'nggallery').' '.$galleryname.' '.('already exists', 'nggallery')); return false; } else { $result = $wpdb->query("INSERT INTO $wpdb->nggallery (name, path, title) VALUES ('$galleryname', '$nggpath', '$gallerytitle') "); if ($result) nggallery::show_message(('Gallery', 'nggallery').' '.$wpdb->insert_id." : ".$galleryname.' '.('successfully created!','nggallery')." ".__('You can show this gallery with the tag','nggallery').' '); return $wpdb->insert_id; }