Where to add custom code after sub form is submitted?

Lakjin

Active Member
Hello,

Where can I add some custom code that runs after the subscribe form is submitted? I want to be able to run custom code if the email addressing subscribing is on the blacklist.

Thanks!
 
Well, you could do something like this from an extension:
PHP:
Yii::app()->hooks->addAction('frontend_controller_lists_before_action', function(CAction $action){
     $action->controller->callbacks->onSubscriberSaveError = function($event){     
         $instances   = $event->params['instances'];
         $subscriber  = $event->params['subscriber']; 
         $list              = $event->params['list'];
         $action         = $event->params['subscribe'];
   
         if (EmailBlacklist::isBlacklisted($subscriber->email)) {
               // is blacklisted, do something.
         }
     }
});
 
Back
Top