Difference between revisions of "Stream API v2"

Line 1: Line 1:
{{alert|<center><strong>WARNING:</strong> API shown bellow is an explanation of the minor update to be implemented for version 2.8. To read the full Activity Stream API for older versions, [[Stream API v1|click here]] </center>|alert-danger}}
+
{{alert|<center><strong>WARNING:</strong> API shown bellow is applies to version 2.8. To read the full Activity Stream API for older versions, [[Stream API v1|click here]] </center>|alert-danger}}
  
 
==Overview==
 
==Overview==
JomSocial 2.8 brings the slight change in how activity streams are handled and introduces the different templates for different type of streams. This allows the easier customization of every individual activity stream item, but this feature is still in a transition period and its currently hard coded, which limits the activity streams for third party providers.
+
JomSocial 2.8 brings the slight change in how activity streams are handled and introduces the different templates for different type of streams. This allows the easier customization of every individual activity stream item, but this feature will require third party components to write in a stream with plugin, unlike it was the case with JomSocial 2.6 and bellow.
  
Till better fix is provided, component developers are required to make 3 changes in their code<br/>
+
This documentation is still in preparation, so please, bare with us.
All changes need to be done in the code responsible for creating activity
+
 
+
===Old code===
+
This is the only area that needs to be changed to support activity streams in jomSocial 2.8
+
<syntaxhighlight lang="php">
+
$act = new stdClass();
+
$act->cmd = 'photos.upload';
+
$act->actor = $my->id;
+
$act->target = 0; // no target
+
$act->title = JText::_('{actor} upload {single}a photo{/single}{multiple}{count} photos{/multiple}');
+
$act->content = '';
+
$act->app = 'wall';
+
$act->cid = 0;
+
$act->params = '';
+
</syntaxhighlight>
+
<br />
+
 
+
===Changes===
+
* Remove the title from activity
+
<syntaxhighlight lang="php">
+
$act->title = '';
+
</syntaxhighlight>
+
<br />
+
* Create the content for activity
+
<syntaxhighlight lang="php">
+
$act->content = JText::_('{actor} upload {single}a photo{/single}{multiple}{count} photos{/multiple}');
+
</syntaxhighlight>
+
<br />
+
* And most importantly, make sure that your application type is set to
+
<syntaxhighlight lang="php">
+
$act->app = 'profile';
+
</syntaxhighlight>
+
<br />
+
If '''$act->app''' is set to anything else then '''profile''', it will not work. <br/>
+
This is the hardcoded issue mentioned at the begining which still causing some issues.<br/>
+
Till proper fix is provided, this will work in most cases.
+

Revision as of 01:40, 4 February 2013

WARNING: API shown bellow is applies to version 2.8. To read the full Activity Stream API for older versions, click here

Overview

JomSocial 2.8 brings the slight change in how activity streams are handled and introduces the different templates for different type of streams. This allows the easier customization of every individual activity stream item, but this feature will require third party components to write in a stream with plugin, unlike it was the case with JomSocial 2.6 and bellow.

This documentation is still in preparation, so please, bare with us.