Forums / Developer / Fetching notification count by object

Fetching notification count by object

Author Message

Norman Leutner

Tuesday 03 January 2006 7:24:01 am

Can anyone give me a hint how to fetch the number or list of users which have added a specific object to thier notification list?

Thanks in advance

Mit freundlichen Grüßen
Best regards

Norman Leutner

____________________________________________________________
eZ Publish Platinum Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh

Norman Leutner

Friday 06 January 2006 2:22:33 am

As far as I can see, there is no specific function to fetch the count for a specific object within the /kernel/notification/function_definition.php

Mit freundlichen Grüßen
Best regards

Norman Leutner

____________________________________________________________
eZ Publish Platinum Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh

Kåre Køhler Høvik

Friday 06 January 2006 2:47:20 am

Hi

You can get the # of subtree notifications to a specific node using this SQL (mysql):

SELECT count( DISTINCT a.user_id ) as count FROM ezsubtree_notification_rule a, ezcontentobject_tree b WHERE b.node_id=NODE_ID AND b.path_string like concat( '%/', a.node_id , '/%' );

( replace NODE_ID with you node ID. )

Kåre Høvik

Marco Zinn

Friday 06 January 2006 3:10:24 am

If you just need this "once in a while": I have an SQL-statement which does print a list of all users and their "notification nodes" for ez 3.4. I think, this should work for 3.5+, too.
But you'll need some access to your DB for this, of course.

Marco
http://www.hyperroad-design.com

Norman Leutner

Wednesday 11 January 2006 8:01:48 am

Thanks a lot, I made a small template operator extension:


{$node.node_id|count_notification()}


   function modify( &$tpl, &$operatorName, &$operatorParameters, &$rootNamespace,
                     &$currentNamespace, &$operatorValue, &$namedParameters )
    {
        switch ( $operatorName )
        {
            case 'count_notification':
            {
              $db =& eZDB::instance();
              $query = "SELECT count( DISTINCT a.user_id ) as count FROM ezsubtree_notification_rule a, ezcontentobject_tree b WHERE b.node_id=".$operatorValue." AND b.path_string like concat( '%/', a.node_id , '/%' )";
              $countResultArray = $db->arrayQuery( $query );
              $operatorValue=$countResultArray[0]['count'];
            } break;
        }
    }

Mit freundlichen Grüßen
Best regards

Norman Leutner

____________________________________________________________
eZ Publish Platinum Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh