]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Incorrect arguments for ActivityPlugin::onEndJoin/LeaveGroup()
authorEvan Prodromou <evan@status.net>
Tue, 23 Aug 2011 14:23:08 +0000 (10:23 -0400)
committerEvan Prodromou <evan@status.net>
Tue, 23 Aug 2011 14:23:08 +0000 (10:23 -0400)
plugins/Activity/ActivityPlugin.php

index b7fbefc329d1c88fa960a7639d82ec7e4046fdda..2785931d0ef9e85058ba4181d9a33312a59f09fd 100644 (file)
@@ -203,14 +203,18 @@ class ActivityPlugin extends Plugin
         return true;
     }
 
-    function onEndJoinGroup($group, $user)
+    function onEndJoinGroup($group, $profile)
     {
         // Only do this if config is enabled
         if(!$this->JoinGroup) return true;
         
-        $profile = $user->getProfile();
+        $user = $profile->getUser();
+        
+        if (empty($user)) {
+            return true;
+        }
         
-        $rendered = sprintf(_m('<em><a href="%s">%s</a> joined the group &quot;<a href="%s">%s</a>&quot;</em>.'),
+        $rendered = sprintf(_m('<em><a href="%s">%s</a> joined the group <a href="%s">%s</a></em>.'),
                                        $profile->profileurl,
                                        $profile->getBestName(),
                             $group->homeUrl(),
@@ -221,8 +225,8 @@ class ActivityPlugin extends Plugin
                             $group->getBestName(),
                                                $group->homeUrl());
 
-               $mem = Group_member::staticGet(array('group_id' => $group->id,
-                                                                                        'profile_id' => $profile->id));
+               $mem = Group_member::pkeyGet(array('group_id' => $group->id,
+                                                                                  'profile_id' => $profile->id));
                                                                                         
         $notice = Notice::saveNew($user->id,
                                   $content,
@@ -234,14 +238,18 @@ class ActivityPlugin extends Plugin
         return true;
     }
 
-    function onEndLeaveGroup($group, $user)
+    function onEndLeaveGroup($group, $profile)
     {
         // Only do this if config is enabled
         if(!$this->LeaveGroup) return true;
         
-        $profile = $user->getProfile();
+        $user = $profile->getUser();
+        
+        if (empty($user)) {
+            return true;
+        }
         
-        $rendered = sprintf(_m('<em><a href="%s">%s</a> left the group &quot;<a href="%s">%s</a>&quot;</em>.'),
+        $rendered = sprintf(_m('<em><a href="%s">%s</a> left the group <a href="%s">%s</a></em>.'),
                                        $profile->profileurl,
                                        $profile->getBestName(),
                             $group->homeUrl(),