From 68b0d2bc4b7fdf093e7e25db5b975feb7c7ab9ee Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Thu, 9 Jan 2014 17:39:13 +0100 Subject: [PATCH] Fixed wrong author in notifications --- .../UserNotificationHandler.class.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php b/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php index 669560aa44..dda1e1bf98 100644 --- a/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php @@ -87,8 +87,23 @@ class UserNotificationHandler extends SingletonFactory { // get objects $objectTypeObject = $this->availableObjectTypes[$objectType]; $event = $this->availableEvents[$objectType][$eventName]; + + // get author's profile + $userProfile = null; + if ($notificationObject->getAuthorID()) { + if ($notificationObject->getAuthorID() == WCF::getUser()->userID) { + $userProfile = new UserProfile(WCF::getUser()); + } + else { + $userProfile = UserProfile::getUserProfile($notificationObject->getAuthorID()); + } + } + if ($userProfile === null) { + $userProfile = new UserProfile(new User(null, array())); + } + // set object data - $event->setObject(new UserNotification(null, array()), $notificationObject, new UserProfile(WCF::getUser()), $additionalData); + $event->setObject(new UserNotification(null, array()), $notificationObject, $userProfile, $additionalData); // find existing events $userIDs = array(); -- 2.20.1