From 1bfbf92868a6402788703443e8d017a3d6155df6 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 23 Aug 2011 10:23:08 -0400 Subject: [PATCH] Incorrect arguments for ActivityPlugin::onEndJoin/LeaveGroup() --- plugins/Activity/ActivityPlugin.php | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/plugins/Activity/ActivityPlugin.php b/plugins/Activity/ActivityPlugin.php index b7fbefc329..2785931d0e 100644 --- a/plugins/Activity/ActivityPlugin.php +++ b/plugins/Activity/ActivityPlugin.php @@ -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('%s joined the group "%s".'), + $rendered = sprintf(_m('%s joined the group %s.'), $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('%s left the group "%s".'), + $rendered = sprintf(_m('%s left the group %s.'), $profile->profileurl, $profile->getBestName(), $group->homeUrl(), -- 2.39.5