In some cases it can be interesting to get notified, if for a specific item a new comment was published on your website. The following example shows how to get this working.
In this example you can see the implementation in module wgGallery
1) Adapt xoops_version.php
First step:
you have to check whether there is a callback function defined or not
b) or if an image of a specific album have been commented
This event will be added by XOOPS itself. Therefore no action is required.
2) Language files
add the defines to your language file modinfo.php
define('_MI_WGGALLERY_GLOBAL_IMG_COMMENT_NOTIFY', 'Notify me about new comments for images');
define('_MI_WGGALLERY_GLOBAL_IMG_COMMENT_NOTIFY_CAPTION', 'Notify me about comments for images');
define('_MI_WGGALLERY_GLOBAL_IMG_COMMENT_NOTIFY_SUBJECT', 'Notification about comments for an image');
define('_MI_WGGALLERY_ALBUMS_IMG_COMMENT_NOTIFY', 'Notify me about new comments for images in this album');
define('_MI_WGGALLERY_ALBUMS_IMG_COMMENT_NOTIFY_CAPTION', 'Notify me about comments for images in this album');
define('_MI_WGGALLERY_ALBUMS_IMG_COMMENT_NOTIFY_SUBJECT', 'Notification about new comment for an image');
3) Adapt include/comment_functions.php
In any case a comment is sent and approved xoops with call the callback function wggalleryCommentsApprove($comment) As a parameter you get the comment object with all necessary information Therefore we need only to add the call of notification handler
Add a notification template to language/english/mail_template (or in your language file directory). Use the name you defined in xoops_version.php (in our example: 'mail_template' => 'global_img_comment_notify',)