public function onAfterThankyou($actor, $target, KunenaForumMessage $message) { CFactory::load ( 'libraries', 'userpoints' ); CUserPoints::assignPoint ( 'com_kunena.thread.thankyou', $target ); $actor = CFactory::getUser($actor); $target = CFactory::getUser($target); //Create CParameter use for params $params = new CParameter(''); $params->set('actorName', $actor->getDisplayName()); $params->set('recipientName', $target->getDisplayName()); $params->set('recipientUrl', 'index.php?option=com_community&view=profile&userid=' . $target->id); // Actor Link $params->set('url', JUri::getInstance()->toString(array('scheme', 'host', 'port')) . $message->getPermaUrl(null)); // {url} tag for activity. Used when hovering over avatar in notification window, as well as in email notification $params->set('title', $message->displayField('subject')); // (title) tag in language file $params->set('title_url' , $message->getPermaUrl() ); // Make the title in notification - linkable $params->set('message', $message->message); // (message) tag in language file $params->set('actor', $actor->getDisplayName()); // Actor in the stream $params->set('actor_url', 'index.php?option=com_community&view=profile&userid=' . $actor->id); // Actor Link // Finally, send notifications CNotificationLibrary::add('kunena_thankyou' , $actor->id , $target->id , JText::sprintf('PLG_KUNENA_COMMUNITY_ACTIVITY_THANKYOU_TITLE_ACT') , JText::sprintf('PLG_KUNENA_COMMUNITY_ACTIVITY_THANKYOU_TEXT') , '' , $params ); $act = new stdClass (); $act->cmd = 'wall.write'; $act->actor = $actor->id; $act->target = $target->id; $act->title = JText::sprintf('PLG_KUNENA_COMMUNITY_ACTIVITY_THANKYOU_WALL', $params->get('actor_url'),$params->get('actor'),$params->get('recipientUrl'),$params->get('recipientName'),$params->get('url'),$params->get('title')); $act->content = NULL; $act->app = 'kunena.message.thankyou'; $act->cid = $target->id; $act->access = $this->getAccess($message->getCategory()); // Comments and like support $act->comment_id = $target->id; $act->comment_type = 'kunena.message.thankyou'; $act->like_id = $target->id; $act->like_type = 'kunena.message.thankyou'; // Do not add private activities if ($act->access > 20) return; CFactory::load ( 'libraries', 'activities' ); $table = CActivityStream::add($act); if(is_object($table)) { $table->like_id = $table->id; $table->store(); } }