xoops forums

Forum Index


Board index » All Posts (goffy)




goffy

Just can't stay away
Posted on: 4/1 7:12
goffy
goffy (Show more)
Just can't stay away
Posts: 401
Since: 2010/12/27
#1

Re: New admin theme in dev : Cockpit_by_monxoops

hi

looks great

send you an email with first findings ;)


goffy

Just can't stay away
Posted on: 3/28 7:08
goffy
goffy (Show more)
Just can't stay away
Posts: 401
Since: 2010/12/27
#2

How to implement a notification for comments

You want to get a notification if someone makes a comment?

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
// Comment callback functions
$modversion['comments']['callbackFile']        = 'include/comment_functions.php';
$modversion['comments']['callback']['approve'] = 'wggalleryCommentsApprove';
$modversion['comments']['callback']['update']  = 'wggalleryCommentsUpdate';


if not please as the definition to xoops_version.php

Second step:
You have to add the notification options, which you want to have. In wgGallery we have the option to get a notification of a comment
a) in any case
// Global Events Image commented
$modversion['notification']['event'][] = [
            
'name'          => 'img_comment_all',
            
'category'      => 'global',
            
'admin_only'    => 0,
            
'title'         => _MI_WGGALLERY_GLOBAL_IMG_COMMENT_NOTIFY,
            
'caption'       => _MI_WGGALLERY_GLOBAL_IMG_COMMENT_NOTIFY_CAPTION,
            
'description'   => '',
            
'mail_template' => 'global_img_comment_notify',
            
'mail_subject'  => _MI_WGGALLERY_GLOBAL_IMG_COMMENT_NOTIFY_SUBJECT,
        ];


b) or if an image of a specific album have been commented
// Album Events Image commented
$modversion['notification']['event'][] = [
            
'name'          => 'image_comment',
            
'category'      => 'albums',
            
'admin_only'    => 0,
            
'title'         => _MI_WGGALLERY_ALBUMS_IMG_COMMENT_NOTIFY,
            
'caption'       => _MI_WGGALLERY_ALBUMS_IMG_COMMENT_NOTIFY_CAPTION,
            
'description'   => '',
            
'mail_template' => 'global_img_comment_notify',
            
'mail_subject'  => _MI_WGGALLERY_ALBUMS_IMG_COMMENT_NOTIFY_SUBJECT,
        ];



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
$helper XoopsModulesWggalleryHelper::getInstance();
// send notifications
$imgId               $comment->getVar('com_itemid');
$imageObj            $helper->getHandler('Images')->get($imgId);
$albId               $imageObj->getVar('img_albid');
$tags                = [];
$tags['IMAGE_NAME']  = $imageObj->getVar('img_name');
$tags['IMAGE_URL']   = XOOPS_URL '/modules/' $GLOBALS['xoopsModule']->getVar('dirname') . '/images.php?op=show&img_id=' $imgId '&alb_id=' $albId;
$tags['ALBUM_URL']   = XOOPS_URL '/modules/' $GLOBALS['xoopsModule']->getVar('dirname') . '/albums.php?op=show&alb_id=' $albId;
$notificationHandler xoops_getHandler('notification');
$notificationHandler->triggerEvent('global'0'img_comment_all'$tags, [], $comment->getVar('com_modid'));
$notificationHandler->triggerEvent('albums'$albId'img_comment'$tags);


4) Add notification template to language file

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'


Thats all :)


goffy

Just can't stay away
Posted on: 3/27 20:50
goffy
goffy (Show more)
Just can't stay away
Posts: 401
Since: 2010/12/27
#3

Re: wgGallery 1.10 ready for testing

Hi Pino

can you please test last version from github?

Dont forget to adapt .\wggallery\language\italian\mail_template\global_img_comment_notify.tpl


goffy

Just can't stay away
Posted on: 3/26 6:44
goffy
goffy (Show more)
Just can't stay away
Posts: 401
Since: 2010/12/27
#4

Re: wgGallery 1.10 ready for testing

Hi Michael

thank you
I will check it


goffy

Just can't stay away
Posted on: 3/25 21:40
goffy
goffy (Show more)
Just can't stay away
Posts: 401
Since: 2010/12/27
#5

Re: wgGallery 1.10 ready for testing

Hi

is there somewhere a documentation how to implement this feature "get notification for each comment"


goffy

Just can't stay away
Posted on: 3/24 21:29
goffy
goffy (Show more)
Just can't stay away
Posts: 401
Since: 2010/12/27
#6

xNewsletter 1.4 RC ready for testing

Hi to all

xNewsletter is a newletter module for xoops
- Usage of one or more e-mail-accounts
- Admin of one or more newsletter possible
- Subscription procedure optionally use confirmation system (double-opt-in)
- Detailed handling of permissions for subscription procedures
- Newsletter are based on templates
- Detailed handling of permissions for groups and newsletter (subscribe, write, send)
- Send: send test mail, resend to all subscribers or only to subscribers, where sending failed
- Sending newsletters to unlimited number of recipients or in packages with certain number of recipients by using cronjob
- Bounced email handler for handling Bounced emails in case of invalid e-mail-addresses
- Optionally synchronisation with mailing lists (e.g. majordomo)
- Maintenance function included
- Creating protocol for the important steps

The current version use namespaces and can be run under PHP 7.4

You can download latest version from https://github.com/XoopsModules25x/xnewsletter

A detailed tutorial you can find at https://app.gitbook.com/@xoops/s/xnewsletter-tutorial/


goffy

Just can't stay away
Posted on: 3/15 8:32
goffy
goffy (Show more)
Just can't stay away
Posts: 401
Since: 2010/12/27
#7

Re: wgGallery 1.10 ready for testing

Hi Michael

I will have a look into it

@Pino: give me some time, then you get it :)


goffy

Just can't stay away
Posted on: 3/12 6:45
goffy
goffy (Show more)
Just can't stay away
Posts: 401
Since: 2010/12/27
#8

Re: wgGallery 1.10 ready for testing

Hi Pino

no, do do not get notification about comments, but you can activate the block for last comments :)


goffy

Just can't stay away
Posted on: 3/9 17:12
goffy
goffy (Show more)
Just can't stay away
Posts: 401
Since: 2010/12/27
#9

Re: wgGallery 1.10 ready for testing

Hi Pino

this is already implemented.
Notifications are linked to specific event happening in wgGallery (e.g. if you want to be notified if someone creates a new album).
Comments you can also activated for images.
You have to check module preferences.

Or did you mean something different?


goffy

Just can't stay away
Posted on: 2/14 15:58
goffy
goffy (Show more)
Just can't stay away
Posts: 401
Since: 2010/12/27
#10

Re: use line-break in tpl files

hi zyspec
hi geekwright

sometime you can't see the forrest because of the trees

thanks, both is working
Quote:
$xoopsMailer->assign('RESULT', 'Newsletter 1' . chr(10) . 'Newsletter 2' . chr(10) . 'Newsletter 3');

Quote:
$xoopsMailer->assign('RESULT', "Newsletter 1 \n Newsletter 2 \n Newsletter 3");



TopTop
(1) 2 3 4 ... 31 »