- Posts: 9
COMMUNITY FORUM
K2 Comments and JomSocial activity stream Hack
- Nico Essig
- Topic Author
- Offline
- New Member
Less
More
14 years 5 months ago #84006
by Nico Essig
K2 Comments and JomSocial activity stream Hack was created by Nico Essig
To show an activity stream update on a user comment in K2 do the following:components/com_k2/models/item.php look for if ($params->get('commentsPublishing')) { (about Line 650)and add directly 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} hat den Artikel <a href="'.$item->link.'">'.$contentTitle.'</a> kommentiert'); $act->content = ''; $act->app = 'wall'; $act->cid = 0; CFactory::load('libraries', 'activities'); CActivityStream::add($act);//
I used code from bwilhelm (www.jomsocial.com/webforum/viewtopic.php?f=20&t=3995) and changed it. So the credits mainly go to him
//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} hat den Artikel <a href="'.$item->link.'">'.$contentTitle.'</a> kommentiert'); $act->content = ''; $act->app = 'wall'; $act->cid = 0; CFactory::load('libraries', 'activities'); CActivityStream::add($act);//
I used code from bwilhelm (www.jomsocial.com/webforum/viewtopic.php?f=20&t=3995) and changed it. So the credits mainly go to him
Please Log in or Create an account to join the conversation.
- FeSys
- Offline
- Elite Member
Less
More
- Posts: 262
14 years 5 months ago #84007
by FeSys
Replied by FeSys on topic K2 Comments and JomSocial activity stream Hack
Wonderful idea..
Nice post " Nico Essig"..
Thanks for sharing
Nice post " Nico Essig"..
Thanks for sharing
Please Log in or Create an account to join the conversation.
- Simon Wells
- Offline
- Platinum Member
Less
More
- Posts: 955
14 years 5 months ago #84008
by Simon Wells
Replied by Simon Wells on topic K2 Comments and JomSocial activity stream Hack
Nice for sharing.
NOTE: Makes sure you make a copy of your item.php, just in case ;)
Simon
K2 Support
NOTE: Makes sure you make a copy of your item.php, just in case ;)
Simon
K2 Support
Please Log in or Create an account to join the conversation.
- Nico Essig
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
14 years 5 months ago #84009
by Nico Essig
Replied by Nico Essig on topic K2 Comments and JomSocial activity stream Hack
Yes. Please do backup your item.php
I edited the first post to include that in a more sophisticated way. This works for cached and uncached sites now.
I edited the first post to include that in a more sophisticated way. This works for cached and uncached sites now.
Please Log in or Create an account to join the conversation.