From 8d864e8e1458ec5a8f6f9dd5872f0ef0a4140ebe Mon Sep 17 00:00:00 2001 From: yarik Date: Fri, 5 Aug 2016 11:25:38 +0300 Subject: [PATCH] Added comments to prod. --- common/behaviors/NotifyBehavior.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/behaviors/NotifyBehavior.php b/common/behaviors/NotifyBehavior.php index 493b5bb..5e64293 100644 --- a/common/behaviors/NotifyBehavior.php +++ b/common/behaviors/NotifyBehavior.php @@ -39,6 +39,11 @@ if($model != NULL) { if(!empty( $owner->user )) { $customer = $owner->user; + if(preg_match('/\S+@\S+\.\S+/', $customer->username)) { + $email = $customer->username; + } else { + return false; + } } $url = ''; if($model::className() == Product::className()) { @@ -62,7 +67,7 @@ 'url' => $url, ], 'subject' => 'Ваш комментарий опубликован', - 'email' => ( !empty( $customer ) ? $customer->email : $owner->email ), + 'email' => ( !empty( $customer ) ? $email : $owner->email ), ]); return $mailer; } -- libgit2 0.21.4