WordPress.org

Support

Support » Plugins and Hacks » NextGEN Public Uploader » [Resolved] Image Upload Notification, but where?

[Resolved] Image Upload Notification, but where?

  • Josh

    @joshdparkergmailcom

    Hi,

    I’m receiving image notification emails, but they only say “A new image has been submitted and is waiting to be reviewed.” In my dashboard, there’s no indication where the image is.

    Once I do find it in my Nextgen gallery, it has been marked “excluded,” and is easy enough to uncheck so it displays.

    The problem is that I will have no idea which (of the many) galleries the uploaded photos are in so that I can approve them.

    Any ideas how to solve this?

    Thanks!
    Josh

    http://wordpress.org/plugins/nextgen-public-uploader/

Viewing 10 replies - 1 through 10 (of 10 total)
  • I too wanted that information. I also wanted to know who did the upload. Seeing that the plugin seems to have no one maintaining it, I gamble that any changes I make to it won’t be updated and overwritten anytime soon.

    Use the following at your own risk. Find and edit the following file:
    plugins\nextgen-public-uploader\inc\npu-upload.php

    Near the bottom of the file, find the email notification function and replace it with this:

    // Function: Send Email Notice
    		public function sendEmail() {
    			global $wpdb;
    			global $current_user;
    			get_currentuserinfo();
    			$gal_id = $_POST['galleryselect'];
    			if(get_option('npu_notification_email')){
    				$to = get_option('npu_notification_email');
    				$subject = "New Image Pending Review - NextGEN Public Uploader";
    				$message = "A new image has been submitted and is waiting to be reviewed.\r\n";
    				$message .="Uploaded by $current_user->user_login, $current_user->display_name, $current_user->user_email.\r\n";
    				$message .="To gallery: $gal_id \r\n";
    				wp_mail( $to, $subject, $message);
    			}
    		}

    This code adds 2 new lines to the message. The first provides Username, Display Name, and email address of the user making the upload. The second provides the ID number of the gallery.

    Perhaps, if someone actually picks up responsibility for the plugin they can add something similar.

    similarly, i got two emails, about a week apart, stating there is a new image awaiting my approval, but there are no new images in my gallery. I only have twelve images in two galleries, so I’d see them if they are there. Could these two visitors have removed the images before I went in to approve them. Seems unlikely.

    Plugin Author Michael Beckwith

    @tw2113

    Noted on more information per email. It’s not a bad idea, just a legacy plugin that needs to be brought up to better current standards. It’s in the works.

    What code could I use if I wanted to include the gallery title/name in addition to the gallery ID?

    Looks like the example above would provide the gallery ID, I would check NGG’s documentation about how to pull gallery information when provided an ID.

    jallinder,
    What I think the “plugin author” is suggesting is that getting the gallery name is not simple.

    I (not an accomplished plug-in or WordPress coder) have hacked around enough to discover that what I think needs be done is a database query for the ‘gallerylist’ array of gallery information and then traverse the returns until a match of $gal_id is found.

    I don’t have a simple modification to the patch I suggested earlier, and I have few enough galleries to manage that the number is enough for me.

    jallinder,
    Persistence (and MySQL inspection) sometimes pays off. Here’s the code you need. Replace the existing function with the following….

    // Function: Send Email Notice
    		public function sendEmail() {
    
    			global $wpdb;
    			global $current_user;
    			get_currentuserinfo();
    			$gal_id = $_POST['galleryselect'];
    			$gal_title = $wpdb->get_var( "SELECT title FROM $wpdb->nggallery WHERE gid = '$gal_id' ");
    			$name = ( empty($gallery->title) ) ? $gallery->name : $gallery->title;
    			if(get_option('npu_notification_email')){
    				$to = get_option('npu_notification_email');
    				$subject = "New Image Pending Review - NextGEN Public Uploader";
    				$message = "A new image has been submitted and is waiting to be reviewed.\r\n";
    				$message .="Uploaded by $current_user->user_login, $current_user->display_name, $current_user->user_email.\r\n";
    				$message .="To gallery: $gal_title \r\n";
    				wp_mail( $to, $subject, $message);
    			}
    		}

    Thanks, Bob! Much appreciated. I was close, but you nailed it.

    hmmmm…. I just noticed that I left a non-functional line in there from an earlier (failed) test. The $name…. line can be deleted.

    I see there has been an upgrade since this post as my npu-upload.php is different than my backup from oct.2013. Can I still use this example to receive the info in the email or will the code modifications you provide be different now?

    backup file:

    // Function: Send Email Notice
    		public function sendEmail() {
    			if(get_option('npu_notification_email')){
    				$to = get_option('npu_notification_email');
    				$subject = "New Image Pending Review - NextGEN Public Uploader";
    				$message = "A new image has been submitted and is waiting to be reviewed.";
    				wp_mail( $to, $subject, $message);
    			}
    		}

    New file:

    // Function: Send Email Notice
    		public function sendEmail() {
    
    			if ( get_option( 'npu_notification_email' ) ) {
    
    				$to      = apply_filters( 'npu_gallery_upload_send_email_to'     , get_option( 'npu_notification_email' ), $this );
    				$subject = apply_filters( 'npu_gallery_upload_send_email_subject', __( 'New Image Pending Review - NextGEN Public Uploader', 'nextgen-public-uploader' ), $this );
    				$message = apply_filters( 'npu_gallery_upload_send_email_message', __( 'A new image has been submitted and is waiting to be reviewed.', 'nextgen-public-uploader' ), $this );
    
    				wp_mail( $to, $subject, $message );
    			}
    		}

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Resolved] Image Upload Notification, but where?’ is closed to new replies.
Skip to toolbar