Snippets for eZ publish 3: Adding subtree notification rules

This is compatible with eZ Publish 3.

This is a Stub article. Help the eZ Publish community by expanding it!

Code sample

The defined variables are:

  • $nodeID: id of the node for which we want to add a subtree notification rule
  • $userID: id of the user for which we want to add the notification rule
include_once( 'kernel/classes/notification/handler/ezsubtree/ezsubtreenotificationrule.php' )
$nodeIDList =& eZSubtreeNotificationRule::fetchNodesForUserID( $userID, false );
if ( !in_array( $nodeID, $nodeIDList ) )
    $rule =& eZSubtreeNotificationRule::create( $nodeID, $userID );