elevate ngg_delete_picture hook
-
In products/photocrati_nextgen/modules/ngglegacy/admin/manage.php there is a method called processor() which calls ngg_delete_picture AFTER $mapper->destroy. The problem is, I need to capture data about the image before it’s deleted, but the hook is being fired too late. I see that there have been several requests for this — can you please address? I’ve reworked the whole method for you below.
function processor() { global $wpdb, $ngg, $nggdb; // Delete a picture if ($this->mode == 'delpic') { do_action('ngg_delete_picture', $this->pid); //TODO:Remove also Tag reference check_admin_referer('ngg_delpicture'); $image = $nggdb->find_image( $this->pid ); if ($image) { if ($ngg->options['deleteImg']) { $storage = $storage = C_Gallery_Storage::get_instance(); $storage->delete_image($this->pid); } $mapper = C_Image_Mapper::get_instance(); $result = $mapper->destroy($this->pid); if ($result) nggGallery::show_message( __('Picture','nggallery').' \''.$this->pid.'\' '.__('deleted successfully','nggallery') ); } $this->mode = 'edit'; // show pictures } // Recover picture from backup if ($this->mode == 'recoverpic') { check_admin_referer('ngg_recoverpicture'); // bring back the old image nggAdmin::recover_image($this->pid); nggGallery::show_message(__('Operation successful. Please clear your browser cache.',"nggallery")); $this->mode = 'edit'; // show pictures } // will be called after a ajax operation if (isset ($_POST['ajax_callback'])) { if ($_POST['ajax_callback'] == 1) nggGallery::show_message(__('Operation successful. Please clear your browser cache.',"nggallery")); } // show sort order if ( isset ($_POST['sortGallery']) ) $this->mode = 'sort'; if ( isset ($_GET['s']) ) $this->search_images(); }
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘elevate ngg_delete_picture hook’ is closed to new replies.