Hey,
Im new to K2 and trying to set up K2 for the first time.
I run JomSocial 2.6.2 and when a new comment is added to a K2 article I want it to show up in the activity stream:
I found this post: getk2.org/community/New-to-K2-Ask-here-first/147628-K2-Add-an-Item-to-Jomsocial-Activity-Stream but it is more then 2 years old and the code is a little messed up.
I manage to make it work with JomSocial 2.6.2
OPEN /www/components/com_k2/models/item.php
FIND
ADD AFTER
or use this pastebin snippet: pastebin.com/xiWzRkhK
If you need to modify it to your language:
FIND
and
REPLACE
with your string...
Hope it work for you as well.
You might be want to read this thread to get updates in JomSocial when someone rate an article: getk2.org/community/New-to-K2-Ask-here-first/169385-Let-ratings-of-K2-articles-show-up-in-JomSocial#169385
Im new to K2 and trying to set up K2 for the first time.
I run JomSocial 2.6.2 and when a new comment is added to a K2 article I want it to show up in the activity stream:
I found this post: getk2.org/community/New-to-K2-Ask-here-first/147628-K2-Add-an-Item-to-Jomsocial-Activity-Stream but it is more then 2 years old and the code is a little messed up.
I manage to make it work with JomSocial 2.6.2
OPEN /www/components/com_k2/models/item.php
FIND
if ($params->get('commentsPublishing'))
{ADD AFTER
//jomsocial activity stream include
$JSinstallchk = JPATH_BASE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php';
//activity stream - added a comment
if ( file_exists($JSinstallchk))
{
require_once($JSinstallchk);
}
$contentTitle = $item->title;
$link = K2HelperRoute::getItemRoute($item->id.':'.urlencode($item->alias),$item->catid.':'.urlencode($item->category->alias));
//$item->link=urldecode(JRoute::_($link));
$item->link=$link;
$act = new stdClass();
$act->cmd = 'wall.write';
$act->actor = $user->id;
$act->target = 0; // no target
$act->title = JText::_('{actor} added a comment to the article <a href="'.$item->link.'">'.$contentTitle.'</a>');
$act->content = '';
$act->app = 'wall';
$act->cid = 0;
CFactory::load('libraries', 'activities');
CActivityStream::add($act);or use this pastebin snippet: pastebin.com/xiWzRkhK
If you need to modify it to your language:
FIND
$act->title = JText::_('{actor} added a comment to the article <a href="'.$item->link.'">'.$contentTitle.'</a>');and
REPLACE
added a comment to the articlewith your string...
Hope it work for you as well.
You might be want to read this thread to get updates in JomSocial when someone rate an article: getk2.org/community/New-to-K2-Ask-here-first/169385-Let-ratings-of-K2-articles-show-up-in-JomSocial#169385