public function listenToPostActionEventCommunityJoin($arguments) { $memberId = sfContext::getInstance()->getUser()->getMemberId(); $communityId = $arguments['actionInstance']->getVar('id'); $communityMember = Doctrine::getTable('CommunityMember')->retrieveByMemberIdAndCommunityId($memberId, $communityId); if (!$communityMember) { $communityMember = new CommunityMember(); $communityMember->setCommunityId($communityId); $communityMember->setMemberId($memberId); $communityMember->setIsPre(true); } if ($communityMember->getIsPre()) { $isInvited = opCommunityIntroductionPlugin::isInvitedCommunity($communityId, $memberId); if ($isInvited) { $communityMember->setIsPre(false); $communityMember->save(); sfContext::getInstance()->getUser()->setFlash('notice', 'You have just joined to this %community%.'); sfContext::getInstance()->getController()->redirect('community/home?id=' . $communityId); } } }