Fixed wrong author in notifications
authorMarcel Werk <burntime@woltlab.com>
Thu, 9 Jan 2014 16:39:13 +0000 (17:39 +0100)
committerMarcel Werk <burntime@woltlab.com>
Thu, 9 Jan 2014 16:39:13 +0000 (17:39 +0100)
wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php

index 669560aa441d64d17554485064f61cb250167d39..dda1e1bf982963851ea7b22a7c97c2617690a37b 100644 (file)
@@ -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();