From d35ee0c834becab5700ba448284864d4b49f749e Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 2 Jun 2020 15:06:22 +0200 Subject: [PATCH] Adapted method to retrieve user fields when method is called by a cronjob Signed-off-by: Cris --- application/models/system/Message_model.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/application/models/system/Message_model.php b/application/models/system/Message_model.php index 6f2a3c7ed..d9f8585ed 100644 --- a/application/models/system/Message_model.php +++ b/application/models/system/Message_model.php @@ -211,12 +211,23 @@ class Message_model extends DB_Model /** * Get message vars data for logged in user + * @param string uid The UID should ONLY be passed if this method is called by a cronjob. + * This is to enable jobs to use templates which use logged-in-user fields ('Eigene Felder'). * @return array|null */ - public function getMsgVarsDataByLoggedInUser() + public function getMsgVarsDataByLoggedInUser($uid = null) { + if (is_string($uid)) + { + $params = array($uid); + } + else + { + $params = array(getAuthUID()); + } + $query = 'SELECT * FROM public.vw_msg_vars_user WHERE my_uid = ?'; - return $this->execQuery($query, array(getAuthUID())); + return $this->execQuery($query, $params); } }