Forums / Developer / Customise notifications

Customise notifications

Author Message

Dries Samyn

Wednesday 15 June 2005 7:06:55 am

Hi,

I posted this in the general forum, but it might fit better here:

We have notification set up so that a user get notified whenever a new article is created in a certain folder.
However, there are 2 issues:
- A notification is send when a new folder is created
- A notification is send when the article is edited

Is there any way you can set "filters" or something to say "only notify if a new node of type article is being created" or something similar?

Or does anybody have any example of "customised" notifications that could help me?

Thanks,

Dries.

Paul Borgermans

Wednesday 15 June 2005 10:56:14 am

Dries,

Please file this as a suggestion or enhancement in the bug tracker as this is not possible now without tweaking the notification system.

It was also discussed a bit during the summer camp

Regards

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Dries Samyn

Thursday 16 June 2005 2:44:13 am

Thanks Paul.
I have now added it as a suggestion.

Is there anybody who could point me to where to tweak the notification system so to implement this?

Regards,

Dries.

Paul Borgermans

Thursday 16 June 2005 3:17:35 am

I think I found it (at least it works like you want here on a live ezp 3.4.6 site):

in file kernel/classes/notification/handler/ezsubtree/ezsubtreehandler.php

around line 122 uncomment the part that checks for an updated version.

So change

...

if (  //$versionObject->attribute( 'version' ) != 1 ||
             $versionObject->attribute( 'version' ) != $contentObject->attribute( 'current_version' ) )
        {
            return EZ_NOTIFICATIONEVENTHANDLER_EVENT_SKIPPED;
        }

....

to

...

if (  $versionObject->attribute( 'version' ) != 1 ||
             $versionObject->attribute( 'version' ) != $contentObject->attribute( 'current_version' ) )
        {
            return EZ_NOTIFICATIONEVENTHANDLER_EVENT_SKIPPED;
        }

....

hth

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Paul Borgermans

Thursday 16 June 2005 3:22:34 am

By consequence, it is easy to change the behaviour according to some scenarios:

- allow the user to have an option to receive updates as well
- turn it on/off globally for notifying updates
- turn notifications off temporarily globally, for a certain node/object or a subtree

What do you think?

Anyone volunteering or should I do it?

Regards

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Dries Samyn

Thursday 16 June 2005 5:21:40 am

Thanks for the pointers Paul.
I've managed to do what I wanted to do by implementing the code you gave, and also by changing:

if ( !$contentClass )
            return EZ_NOTIFICATIONEVENTHANDLER_EVENT_SKIPPED;

with

if ( !$contentClass ||
        	$contentClass->attribute( 'name' )!="News Article" )
        {
            return EZ_NOTIFICATIONEVENTHANDLER_EVENT_SKIPPED;
        }

where obviously "News Article" is the name of the content class of the content that I want to be queued for notifications.
This works fine. It'd be great, as a suggestion, if in a future release these things could be configured in the notification ini file.

Thanks again for the help.

Dries.

Andy Caiger

Wednesday 29 June 2011 10:59:12 pm

Six years later, is it possible to do this with eZ Publish out of the box, or do we still have to modify the kernel PHP? Filtering notifications on class or on new objects versus existing objects (as we can do using the publish workflow) seems a very useful thing to be able to do. Is it possible now?

EAB - Integrated Internet Success
Offices in England, France & China.
http://www.eab.co.uk http://www.eab-china.com http://www.eab-france.com

eZ debug

Timing: Jan 29 2025 13:40:02
Script start
Timing: Jan 29 2025 13:40:02
Module start 'content'
Timing: Jan 29 2025 13:40:02
Module end 'content'
Timing: Jan 29 2025 13:40:03
Script end

Main resources:

Total runtime0.1404 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0062 587.9219180.8438
Module start 'content' 0.00620.0066 768.7656101.9922
Module end 'content' 0.01280.1276 870.7578530.5234
Script end 0.1404  1,401.2813 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00352.4634200.0002
Check MTime0.00120.8838200.0001
Mysql Total
Database connection0.00060.439410.0006
Mysqli_queries0.093766.71991410.0007
Looping result0.00100.74101390.0000
Template Total0.127290.610.1272
Template load0.00090.673610.0009
Template processing0.126289.882910.1262
Override
Cache load0.00060.453710.0006
Sytem overhead
Fetch class attribute can translate value0.00070.470810.0007
XML
Image XML parsing0.00020.172310.0002
General
dbfile0.00906.4091200.0004
String conversion0.00000.005830.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs