Difference between revisions of "Stream API v2"

(Waiting for input)
(Overview)
Line 1: Line 1:
 
{{alert|<center><strong>WARNING:</strong> API explained bellow works only with JomSocial 2.8 and above. If you need Activity Stream API for older versions, [[Stream API v1|click here]] </center>|alert-danger}}
 
{{alert|<center><strong>WARNING:</strong> API explained bellow works only with JomSocial 2.8 and above. If you need 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 is still in a transition period and its currently hard coded, which limits the activity streams for third party providers.
  
Till better fix is provided, component developers are required to make 2 changes in their code<br/>
+
Till better fix is provided, component developers are required to make 3 changes in their code<br/>
When creating the activity stream item
+
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">
 
<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>
 
</syntaxhighlight>
 
<br />
 
<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 13:16, 1 February 2013

WARNING: API explained bellow works only with JomSocial 2.8 and above. If you need 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 is still in a transition period and its currently hard coded, which limits the activity streams for third party providers.

Till better fix is provided, component developers are required to make 3 changes in their code
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

$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	= '';


Changes

  • Remove the title from activity
$act->title = '';


  • Create the content for activity
$act->content = JText::_('{actor} upload {single}a photo{/single}{multiple}{count} photos{/multiple}');


  • And most importantly, make sure that your application type is set to
$act->app = 'profile';


If $act->app is set to anything else then profile, it will not work.
This is the hardcoded issue mentioned at the begining which still causing some issues.
Till proper fix is provided, this will work in most cases.