public static function load_templates() { $notifications = apply_filters('sprout_notifications', array()); foreach ($notifications as $notification_id => $data) { // Find existing notification $notification = SI_Notifications_Control::get_notification_instance($notification_id); // Delete all the existing notifications if (is_a($notification, 'SI_Notification')) { wp_delete_post($notification->get_id(), true); } // Create new notification with new content $post_id = wp_insert_post(array('post_status' => 'publish', 'post_type' => SI_Notification::POST_TYPE, 'post_title' => $data['default_title'], 'post_content' => self::notification_content($notification_id))); $notification = SI_Notification::get_instance($post_id); SI_Notifications_Control::save_meta_box_notification_submit($post_id, $notification->get_post(), array(), $notification_id); // Don't allow for a notification to enabled if specifically shouldn't if (isset($data['always_disabled']) && $data['always_disabled']) { $notification->set_disabled('TRUE'); } update_option(SI_Notifications_Control::EMAIL_FORMAT, 'HTML'); } }