简体   繁体   English

jomsocial groups and events integration

[英]jomsocial groups and events integration

I am trying to integrate jomsocial events with jomsocial groups. 我正在尝试将jomsocial事件与jomsocial组合并。 What i am trying to achieve is to automatically create a group when the event is being created. 我想要实现的是在创建事件时自动创建一个组。

Would anyone have some hints regarding such functionality? 有人会对这些功能有一些提示吗? The approach i have in mind is to utilize a function onEventCreate($event) from jomsocial API to call the group creation mechanism. 我想到的方法是利用jomsocial API中的函数onEventCreate($ event)来调用组创建机制。 Is that the right way to do it? 这是正确的方法吗?

Yes, this is the approach I'd take. 是的,这是我采取的方法。

You can find method save() in groups.php controller. 您可以在groups.php控制器中找到方法save()。 There you've got all of the required code to implement this. 在那里,您已经拥有了实现此功能所需的所有代码。

The 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('Y-m-d 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM