Joining in jomsocial groups and events

I am trying to integrate jomsocial events with jomsocial groups. I am trying to achieve automatic group creation when an event is created.

Does anyone have any hints of such functionality? The approach I have in mind is to use the onEventCreate ($ event) function from the jomsocial API to call the group creation mechanism. Is this the right way to do this?

+4
source share
1 answer

Yes, this is the approach I will take.

You can find the save () method in the groups.php controller. There you received all the necessary code for its implementation.

Rough code:

$my =& CFactory::getUser(); $config =& CFactory::getConfig(); $group =& JTable::getInstance( 'Group' , 'CTable' ); $group->name = $name; $group->description = $description; $group->categoryid = $categoryId; // Category Id must not be empty and will cause failure on this group if its empty. $group->website = $website; $group->ownerid = $my->id; $group->created = gmdate('Ymd H:i:s'); $group->approvals = 0; $params = new CParameter( '' ); // Here you need some code from private _bindParams() $group->params = $params->toString(); $group->published = ( $config->get('moderategroupcreation') ) ? 0 : 1; $group->store(); // Other useful stuff: // - store the creator / admin into the groups members table // - add into activity stream 
+1
source

All Articles