Difference between revisions of "Stream API v2"

(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 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}}
  
 
==Overview==
 
==Overview==

Revision as of 13:18, 1 February 2013

WARNING: 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, 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.