Keyword

[SOLVED] K2 Add an Item to Jomsocial Activity Stream

  • Trevor Goff
  • Trevor Goff's Avatar Topic Author
  • Offline
  • New Member
More
14 years 1 week ago #89230 by Trevor Goff
Hey all,
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.

More
13 years 11 months ago #89231 by Ed Deyzel
Replied by Ed Deyzel on topic K2 Add an Item to Jomsocial Activity Stream
Hi,

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
  • Trevor Goff's Avatar Topic Author
  • Offline
  • New Member
More
13 years 11 months ago #89232 by Trevor Goff
Replied by Trevor Goff on topic K2 Add an Item to Jomsocial Activity Stream
Ed Deyzel said:Hi, I was wondering if you ever figured this out?

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.

More
13 years 11 months ago #89233 by Ed Deyzel
Replied by Ed Deyzel on topic K2 Add an Item to Jomsocial Activity Stream
Thanks, that helped allot but I think when you pasted the code the editor changed some of it so I get a link but the link is not linking to the article. The line below is what I'm unclear on as this is what is stated above:

$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
  • Trevor Goff's Avatar Topic Author
  • Offline
  • New Member
More
13 years 11 months ago #89234 by Trevor Goff
Replied by Trevor Goff on topic K2 Add an Item to Jomsocial Activity Stream
Ed Deyzel said:Thanks, that helped allot but I think when you pasted the code the editor changed some of it so I get a link but the link is not linking to the article. The line below is what I'm unclear on as this is what is stated above:
$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.

More
13 years 11 months ago #89235 by Dave Marshall
Replied by Dave Marshall on topic K2 Add an Item to Jomsocial Activity Stream
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! ;)

Please Log in or Create an account to join the conversation.

  • Trevor Goff
  • Trevor Goff's Avatar Topic Author
  • Offline
  • New Member
More
13 years 11 months ago #89236 by Trevor Goff
Replied by Trevor Goff on topic K2 Add an Item to Jomsocial Activity Stream
Dave Marshall said:
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.

More
13 years 11 months ago #89237 by Ed Deyzel
Replied by Ed Deyzel on topic K2 Add an Item to Jomsocial Activity Stream
Sorry for the late reply but thanks for the code, it's working a charm.

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
  • Trevor Goff's Avatar Topic Author
  • Offline
  • New Member
More
13 years 11 months ago #89238 by Trevor Goff
Replied by Trevor Goff on topic K2 Add an Item to Jomsocial Activity Stream
Ed Deyzel said:Sorry for the late reply but thanks for the code, it's working a charm.
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.

More
13 years 1 month ago #89239 by Ilia
Hi,

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.


Powered by Kunena Forum