From d4751696f33ec7aff9c8f785bbda684d7565fbe9 Mon Sep 17 00:00:00 2001 From: Joey Kimsey Date: Thu, 23 Jan 2025 22:39:11 -0500 Subject: [PATCH] sendmail bugfix --- app/controllers/admin/send_mail.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/send_mail.php b/app/controllers/admin/send_mail.php index e89a3dd..e2065e5 100644 --- a/app/controllers/admin/send_mail.php +++ b/app/controllers/admin/send_mail.php @@ -18,6 +18,7 @@ use TheTempusProject\Houdini\Classes\Issues; use TheTempusProject\Houdini\Classes\Views; use TheTempusProject\Models\User; use TheTempusProject\Models\Subscribe; +use TheTempusProject\Plugins\Subscribe as Plugin; class SendMail extends AdminController { public static $user; @@ -27,10 +28,24 @@ class SendMail extends AdminController { parent::__construct(); self::$title = 'Admin - Send Mail'; self::$user = new User; - self::$subscribe = new Subscribe; + + if ( class_exists( 'TheTempusProject\Plugins\Subscribe' ) ) { + $plugin = new Plugin; + if ( ! $plugin->checkEnabled() ) { + Issues::add( 'notice', 'Subscriptions are disabled so those feature will be unavailable.' ); + } else { + self::$subscribe = new Subscribe; + } + } else { + Issues::add( 'notice', 'Subscriptions plugin is not installed so those feature will be unavailable.' ); + } } private function emailSubscribers( $params ) { + if ( empty( self::$subscribe ) ) { + Issues::add( 'error', 'Subscriptions plugin is unavailable' ); + return; + } $list = self::$subscribe->list(); if ( empty( $list ) ) { Issues::add( 'error', 'No subscribers found' );