From 89e62c95a7ffd71a8e860f59378ecd13d6cbb196 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Tue, 9 Oct 2018 21:47:31 +0200 Subject: Changed more functions :tada: --- includes/helper/email_helper.php | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'includes/helper/email_helper.php') diff --git a/includes/helper/email_helper.php b/includes/helper/email_helper.php index 8668cab0..4fc10226 100644 --- a/includes/helper/email_helper.php +++ b/includes/helper/email_helper.php @@ -1,19 +1,32 @@ user(); - if ($not_if_its_me && $user->id == $recipient_user['UID']) { + if ($recipientUser instanceof User) { + $id = $user->id; + $lang = $user->settings->language; + $email = $user->contact->email ? $user->contact->email : $user->email; + $username = $user->name; + } else { + $id = $recipientUser['UID']; + $lang = $recipientUser['Sprache']; + $email = $recipientUser['email']; + $username = $recipientUser['Nick']; + } + + if ($notIfItsMe && $user->id == $id) { return true; } @@ -23,12 +36,12 @@ function engelsystem_email_to_user($recipient_user, $title, $message, $not_if_it /** @var EngelsystemMailer $mailer */ $mailer = app('mailer'); - $translator->setLocale($recipient_user['Sprache']); + $translator->setLocale($lang); $status = $mailer->sendView( - $recipient_user['email'], + $email, $title, 'emails/mail', - ['username' => $recipient_user['Nick'], 'message' => $message] + ['username' => $username, 'message' => $message] ); $translator->setLocale($locale); -- cgit v1.2.3-54-g00ecf