Patch for send admin email when comments are added

joyjit

Joined: 2005-03-27
Posts: 16
Posted: Sun, 2005-03-27 20:46

I am using Gallery v 1.4.4-pl6 in embedded mode and I think there is a bug in Gallery.

* In Gallery Congfiguration, set "Admin Comments Email: yes" and set an email address for Admin

* In my gallery setup, since I am using it in embedded mode, there is no user called "admin" (instead there are a few users who have admin rights)

* Now, when someone adds a comment, the email address which was set up in configuration does not seem to receive any email.

I think there is a bug in function Album::getEmailMeList() in classes/Album.php where it only looks up an user called 'admin'. This logic fails in my case.

So I added some code to the end of this function, just before this line in this function, to fix the problem:
return array_unique($result)

And this is the code I added

    if( gallery_validate_email($gallery->app->adminEmail) ) {
        if ($type == 'comments' && $gallery->app->adminCommentsEmail == "yes") {
            $result[]=$gallery->app->adminEmail;
        } else if ($type == 'other' && $gallery->app->adminOtherChangesEmail == "yes") {
            $result[]=$gallery->app->adminEmail;
        }
    }