本文整理匯總了PHP中Hubzero\User\Group::remove方法的典型用法代碼示例。如果您正苦於以下問題:PHP Group::remove方法的具體用法?PHP Group::remove怎麽用?PHP Group::remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Hubzero\User\Group
的用法示例。
在下文中一共展示了Group::remove方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: removeTask
/**
* Remove member(s) from a group
* Disallows removal of last manager (group must have at least one)
*
* @return void
*/
public function removeTask()
{
// Check for request forgeries
Request::checkToken(['get', 'post']);
$gid = Request::getVar('gid', '');
// Load the group page
$group = new Group();
$group->read($gid);
// Get all the group's managers
$managers = $group->get('managers');
// Get all the group's members
$members = $group->get('members');
$users_mem = array();
$users_man = array();
// Incoming array of users to remove
$id = Request::getInt('id', 0);
// Ensure we found an account
if (!$id) {
\App::abort(404, Lang::txt('COM_MEMBERS_NOT_FOUND'));
}
if (in_array($id, $members)) {
$users_mem[] = $id;
}
if (in_array($id, $managers)) {
$users_man[] = $id;
}
// Remove users from members list
$group->remove('members', $users_mem);
// Remove users from managers list
$group->remove('managers', $users_man);
// Save changes
$group->update();
// Push through to the groups view
$this->displayTask($id);
}