- Posts: 5
COMMUNITY FORUM
[SOLVED] K2 Add an Item to Jomsocial Activity Stream
- Trevor Goff
-
Topic Author
- Offline
- New Member
I have been working with integrating Jomsocial with K2 (which i have read all discussions about here already) and are specifically working with adding a blog to Jomsocial Activity Stream.
Ive reviewed and implemented Nicos code here community.getk2.org/forum/topics/k2-comments-and-jomsocial and it works great. But ive managed to get it posting to the activity stream by adding the same code type in administrator/component/com_k2/models/item.php ~ line 634, after case 'save'.
It will post to stream, but miss the link. Im not a pro PHP guy, but if someone can shed some light on what to change so it can pull that link, well have a nice plugin for adding blogs to Jomsocial that many people can use.
Thanks in Advance
Please Log in or Create an account to join the conversation.
- Ed Deyzel
-
- Offline
- New Member
- Posts: 10
I was wondering if you ever figured this out?
Also, how did you manage to get it to display the title at all?
Cheers
Please Log in or Create an account to join the conversation.
- Trevor Goff
-
Topic Author
- Offline
- New Member
- Posts: 5
Also, how did you manage to get it to display the title at all?
Cheers
Hey Ed,
I did actually figure out something on this. In administrator/components/com_k2/models/item.php ~ Line 632
case 'save':
default:
add this altered version of Nico's code,
//
//jomsocial activity stream include
$JSinstallchk = JPATH_BASE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php';
//activity stream - added a blog
if ( file_exists($JSinstallchk)) {
require_once($JSinstallchk);
}
$contentTitle = $row->title;
$link = 'index.php?option=com_k2&view=item&id='.$row->id.;
$item->link=$link;
$act = new stdClass();
$act->cmd = 'wall.write';
$act->actor = $user->id;
$act->target = 0; // no target
$act->title = JText::_('{actor} has created blog link.'"'>'.$contentTitle.'');
$act->content = '';
$act->app = 'wall';
$act->cid = 0;
CFactory::load('libraries', 'activities');
CActivityStream::add($act);
//
This will show a new blog post to JS Activity Stream. It will also post the same if you edit. Its a band-aid, but works :D
Hope this Helps!
Please Log in or Create an account to join the conversation.
- Ed Deyzel
-
- Offline
- New Member
- Posts: 10
$act->title = JText::_('{actor} has created blog link.'"'>'.$contentTitle.'');
I changed it to but it's linking to the front page of the site and not to article or recipe in my case:
$act->title = JText::_('{actor} added a recipe link.'"'>'.$contentTitle.'');
Thanks allot for the reply.
Ed
Please Log in or Create an account to join the conversation.
- Trevor Goff
-
Topic Author
- Offline
- New Member
- Posts: 5
$act->title = JText::_('{actor} has created blog link.'"'>'.$contentTitle.'');
I changed it to but it's linking to the front page of the site and not to article or recipe in my case:
$act->title = JText::_('{actor} added a recipe link.'"'>'.$contentTitle.'');
Thanks allot for the reply.
Ed
Oh sorry,
I have uploaded a sample file, hope this helps :D
Please Log in or Create an account to join the conversation.
- Dave Marshall
-
- Offline
- New Member
- Posts: 8
Hope this Helps!
True it will post to the activity stream when editing an article if you hit the "Save Button"! If you use the "Apply Button" then the "Cancel Button" it won't be posted to the Activity Stream! ;)
Please Log in or Create an account to join the conversation.
- Trevor Goff
-
Topic Author
- Offline
- New Member
- Posts: 5
Trevor Goff said:This will show a new blog post to JS Activity Stream. It will also post the same if you edit. Its a band-aid, but works :D
Hope this Helps!
True it will post to the activity stream when editing an article if you hit the "Save Button"! If you use the "Apply Button" then the "Cancel Button" it won't be posted to the Activity Stream! ;)
Yeah that was the plan. Unfortunately it will also post to the activity stream when doing an edit as well, still working that one out :D
Please Log in or Create an account to join the conversation.
- Ed Deyzel
-
- Offline
- New Member
- Posts: 10
Just one thing I'm having a issue with is the item id. Do you know how to get it to assign the menu item id as it's creating duplicates in ACESEF?
$link = 'index.php?option=com_k2&view=item&id='.$row->id.'&Itemid=4940';
Ed
Please Log in or Create an account to join the conversation.
- Trevor Goff
-
Topic Author
- Offline
- New Member
- Posts: 5
Just one thing I'm having a issue with is the item id. Do you know how to get it to assign the menu item id as it's creating duplicates in ACESEF?
$link = 'index.php?option=com_k2&view=item&id='.$row->id.'&Itemid=4940';
Ed
Try taking out the itemid part so it just says 'index.php?option=com_k2&view=item&id='.$row->id.';
I forced that one since that was all it needed. Usually i think it will auto append the itemid to what menu item its clicked off of...so you can remove or edit the ItemId to whatever Id you wish...i hope this helps :D
Please Log in or Create an account to join the conversation.
- Ilia
-
- Offline
- New Member
- Posts: 2
How to make a Aktiviti Stream function adds only after publication, not after save?
Please Log in or Create an account to join the conversation.
- Tracey Hood
-
- Offline
- New Member
- Posts: 17
Please Log in or Create an account to join the conversation.
- Tracey Hood
-
- Offline
- New Member
- Posts: 17
Please Log in or Create an account to join the conversation.
- Thorsten
-
- Offline
- New Member
- Posts: 17
Please Log in or Create an account to join the conversation.