- Posts: 24
COMMUNITY FORUM
Let ratings of K2 articles show up in JomSocial
- frold
- Topic Author
- Offline
- Junior Member
Less
More
11 years 7 months ago - 11 years 7 months ago #110005
by frold
Let ratings of K2 articles show up in JomSocial was created by frold
Hey,
I run JomSocial 2.6.2 and when a new article is rated in K2 I want it to show up in the activity stream:
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/gqgcCkv8
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 comments an article: getk2.org/community/New-to-K2-Ask-here-first/169372-Let-comments-in-K2-articles-show-up-in-JomSocial#169372
I run JomSocial 2.6.2 and when a new article is rated in K2 I want it to show up in the activity stream:
I manage to make it work with JomSocial 2.6.2
OPEN /www/components/com_k2/models/item.php
FIND
$query = "INSERT INTO #__k2_rating ( itemID, lastip, rating_sum, rating_count ) VALUES ( ".(int)$item->id.", ".$db->Quote($userIP).", {$rate}, 1 )";
ADD AFTER
//jomsocial activity stream include
$JSinstallchk = JPATH_BASE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php';
//activity stream - rated an article
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} has rated this 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/gqgcCkv8
If you need to modify it to your language:
FIND
$act->title = JText::_('{actor} has rated this article <a href="'.$item->link.'">'.$contentTitle.'</a>');
and
REPLACE
has rated this article
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 comments an article: getk2.org/community/New-to-K2-Ask-here-first/169372-Let-comments-in-K2-articles-show-up-in-JomSocial#169372
Please Log in or Create an account to join the conversation.