Пример #1
0
 private function notify($post_id, $attachedData = null)
 {
     $form =& $this->_formData;
     $_fields = $form->getFields();
     // init notification manager if needed
     if (isset($_fields['notification']->enable) && $_fields['notification']->enable && !empty($_fields['notification']->notifications)) {
         // add extra plceholder codes
         add_filter('cred_subject_notification_codes', array(&$this, 'extraSubjectNotificationCodes'), 5, 3);
         add_filter('cred_body_notification_codes', array(&$this, 'extraBodyNotificationCodes'), 5, 3);
         CRED_Loader::load('CLASS/Notification_Manager');
         if ($form->getForm()->post_type == CRED_USER_FORMS_CUSTOM_POST_NAME) {
             CRED_Notification_Manager::set_user_fields();
         }
         // add the post to notification management
         CRED_Notification_Manager::add($post_id, $form->getForm()->ID, $_fields['notification']->notifications);
         // send any notifications now if needed
         CRED_Notification_Manager::triggerNotifications($post_id, array('event' => 'form_submit', 'form_id' => $form->getForm()->ID, 'notification' => $_fields['notification']), $attachedData);
         // remove extra plceholder codes
         remove_filter('cred_subject_notification_codes', array(&$this, 'extraSubjectNotificationCodes'), 5, 3);
         remove_filter('cred_body_notification_codes', array(&$this, 'extraBodyNotificationCodes'), 5, 3);
     }
 }