classes/ezcomcommentcommonmanager.php
public function afterUpdatingComment( $comment, $notified, $time )
    {
        $user = eZUser::fetch( $comment->attribute( 'user_id' ) );

        // if notified is true, add subscription, else cleanup the subscription on the user and content
        $contentID = $comment->attribute( 'contentobject_id' );
        $languageID = $comment->attribute( 'language_id' );
        $subscriptionType = 'ezcomcomment';
        if ( !is_null( $notified ) )
        {
            $subscriptionManager = ezcomSubscriptionManager::instance();
            if ( $notified === true )
            {
                //add subscription but not send activation
                try
                {
                $subscriptionManager->addSubscription( $comment->attribute( 'email' ),
                                                       $user,
                                                       $contentID,
                                                       $languageID,
                                                       $subscriptionType,
                                                       $time,
                                                       false );
                }
                catch ( Exception $e )
                {
                    eZDebug::writeError( $e->getMessage(), __METHOD__ );
                    switch ( $e->getCode() )
                    {
                        case ezcomSubscriptionManager::ERROR_SUBSCRIBER_DISABLED:
                            return 'The subscriber is disabled.';
                        default:
                            return false;
                    }
                }
            }
            else
            {
                $subscriptionManager->deleteSubscription( $comment->attribute( 'email' ),
                                                          $comment->attribute( 'contentobject_id' ),
                                                          $comment->attribute( 'language_id' ) );
            }
        }
        //3. update queue. If there is subscription, add one record into queue table
        // if there is subcription on this content, add one item into queue
        if ( ezcomSubscription::exists( $contentID, $languageID,  $subscriptionType ) )
        {
            $notification = ezcomNotification::create();
            $notification->setAttribute( 'contentobject_id', $comment->attribute( 'contentobject_id' ) );
            $notification->setAttribute( 'language_id', $comment->attribute( 'language_id' ) );
            $notification->setAttribute( 'comment_id', $comment->attribute( 'id' ) );
            $notification->store();
            eZDebugSetting::writeNotice( 'extension-ezcomments', 'There are subscriptions, added an update notification to the queue.', __METHOD__ );
        }
        else
        {
            // todo: if there is no subscription on this content, consider to clean up the queue
        }
        return true;
    }
public function afterUpdatingComment( $comment, $notified, $time )
    {
        $user = eZUser::fetch( $comment->attribute( 'user_id' ) );

        // if notified is true, add subscription, else cleanup the subscription on the user and content
        $contentID = $comment->attribute( 'contentobject_id' );
        $languageID = $comment->attribute( 'language_id' );
        $subscriptionType = 'ezcomcomment';
        if ( !is_null( $notified ) )
        {
            $subscriptionManager = ezcomSubscriptionManager::instance();
            if ( $notified === true )
            {
                //add subscription but not send activation
                try
                {
                $subscriptionManager->addSubscription( $comment->attribute( 'email' ),
                                                       $user,
                                                       $contentID,
                                                       $languageID,
                                                       $subscriptionType,
                                                       $time,
                                                       false );
                }
                catch ( Exception $e )
                {
                    eZDebug::writeError( $e->getMessage(), __METHOD__ );
                    switch ( $e->getCode() )
                    {
                        case ezcomSubscriptionManager::ERROR_SUBSCRIBER_DISABLED:
                            return 'The subscriber is disabled.';
                        default:
                            return false;
                    }
                }
            }
            else
            {
                $subscriptionManager->deleteSubscription( $comment->attribute( 'email' ),
                                                          $comment->attribute( 'contentobject_id' ),
                                                          $comment->attribute( 'language_id' ) );
            }
        }
        //3. update queue. If there is subscription, add one record into queue table
        // if there is subcription on this content, add one item into queue
        if ( ezcomSubscription::exists( $contentID, $languageID,  $subscriptionType ) )
        {
            $notification = ezcomNotification::create();
            $notification->setAttribute( 'contentobject_id', $comment->attribute( 'contentobject_id' ) );
            $notification->setAttribute( 'language_id', $comment->attribute( 'language_id' ) );
            $notification->setAttribute( 'comment_id', $comment->attribute( 'id' ) );
            $notification->store();
            eZDebugSetting::writeNotice( 'extension-ezcomments', 'There are subscriptions, added an update notification to the queue.', __METHOD__ );
        }
        else
        {
            // todo: if there is no subscription on this content, consider to clean up the queue
        }
        return true;
    }
public function afterUpdatingComment ( $ comment , $ notified , $ time ) { $ user = eZUser :: fetch ( $ comment -> attribute ( 'user_id' ) ) ; // if notified is true, add subscription, else cleanup the subscription on the user and content $ contentID = $ comment -> attribute ( 'contentobject_id' ) ; $ languageID = $ comment -> attribute ( 'language_id' ) ; $ subscriptionType = 'ezcomcomment' ; if ( ! is_null ( $ notified ) ) { $ subscriptionManager = ezcomSubscriptionManager :: instance ( ) ; if ( $ notified === true ) { //add subscription but not send activation try { $ subscriptionManager -> addSubscription ( $ comment -> attribute ( 'email' ) , $ user , $ contentID , $ languageID , $ subscriptionType , $ time , false ) ; } catch ( Exception $ e ) { eZDebug :: writeError ( $ e -> getMessage ( ) , __METHOD__ ) ; switch ( $ e -> getCode ( ) ) { case ezcomSubscriptionManager :: ERROR_SUBSCRIBER_DISABLED : return 'The subscriber is disabled.' ; default : return false ; } } } else { $ subscriptionManager -> deleteSubscription ( $ comment -> attribute ( 'email' ) , $ comment -> attribute ( 'contentobject_id' ) , $ comment -> attribute ( 'language_id' ) ) ; } } //3. update queue. If there is subscription, add one record into queue table // if there is subcription on this content, add one item into queue if ( ezcomSubscription :: exists ( $ contentID , $ languageID , $ subscriptionType ) ) { $ notification = ezcomNotification :: create ( ) ; $ notification -> setAttribute ( 'contentobject_id' , $ comment -> attribute ( 'contentobject_id' ) ) ; $ notification -> setAttribute ( 'language_id' , $ comment -> attribute ( 'language_id' ) ) ; $ notification -> setAttribute ( 'comment_id' , $ comment -> attribute ( 'id' ) ) ; $ notification -> store ( ) ; eZDebugSetting :: writeNotice ( 'extension-ezcomments' , 'There are subscriptions, added an update notification to the queue.' , __METHOD__ ) ; } else { // todo: if there is no subscription on this content, consider to clean up the queue } return true ; }
clean up subscription after updating comment
@see extension/ezcomments/classes/ezcomCommentManager#afterUpdatingComment($comment, $notified)
clean up subscription after updating comment