我正在寻找可以创建群组的网络服务。我查看了elgg中可用的Web服务。我只能找到以下与该组相关的Web服务 -
组
我们在elgg中是否有任何创建群组网络服务的内容。
答案 0 :(得分:1)
请在ELGG/engine/lib/web_services.php
/**
* The group.save API.
* This API call lets a user to create group.
*
* @param string $name group name
* @param string $briefdescription short description
* @param string $description long description
* @param string $interests tags comma separated
* @param int $group_guid GUID of group if its edit request
*
* @return bool success/fail
* @access public
*/
function group_save($name, $briefdescription, $description, $interests, $group_guid)
{
//you can change/pass below parameters from POST
$_GET['action']='groups/edit';
$_POST['membership'] = '2';
$_POST['activity_enable'] = 'yes';
$_POST['blog_enable'] = 'yes';
$_POST['forum_enable'] = 'yes';
$_POST['pages_enable'] = 'yes';
//include file at location "ELGG/mod/groups/actions/groups/edit.php"
include_once '../../mod/groups/actions/groups/edit.php';
//Or you can copy all code from that file and paste it here. And do modification according to your need.
}
最后,您应该公开如下函数:
expose_function(
"group.save",
"group_save",
array(
'name' => array ('type' => 'string'),
'briefdescription' => array ('type' => 'string'),
'description' => array ('type' => 'string'),
'interests' => array ('type' => 'string'),
'group_guid' => array ('type' => 'int', 'required' => false),
),
'User add/edit group',
'POST',
true,
true
);
答案 1 :(得分:0)
PawełSroka是对的。你可以制作一个带有manifest.xml和start.php的基本插件,并将你的代码放在start.php中,无论你在其中编写单个函数还是数百个函数都无关紧要。 例如,您可以查看以下插件:https://github.com/markharding/elgg-web-services