Documentation

Update

int
CSocNetGroup::Update(
 int ID,
 array arFields,
 bool bAutoSubscribe = true,
 bool bClearCommonTag = true
);

The method modifies parameters of workgroup with the set ID. Static method.

Note: when method is executed, the events are called: [link=191806]OnBeforeSocNetGroupUpdate[/link] and [link=191827]OnSocNetGroupUpdate[/link].

Parameters

Parameter Description Available from version
ID Group ID
arFields Array of group parameters to be updated. Array keys are parameter names, values - new updated values. Available keys: SITE_ID - site ID (required field),
NAME - group name (required field),
DESCRIPTION - group description,
VISIBLE - Y/N flag - group visibility in the group list,
OPENED - Y/N flag- is the group open for users to join freely,
SUBJECT_ID - topic ID (required field),
KEYWORDS - keywords,
IMAGE_ID - group icon,
INITIATE_PERMS - who has permissions to invite users to the workgroup (required field): SONET_ROLES_OWNER - only the group owner, SONET_ROLES_MODERATOR - group owner and group moderators, SONET_ROLES_USER - all group members,
CLOSED - Y/N flag - archive group status,
SPAM_PERMS - who has permissions to end messages to the group: SONET_ROLES_OWNER - only the group owner, SONET_ROLES_MODERATOR - group owner and group moderators, SONET_ROLES_USER - all group members.*
ID
bAutoSubscribe Autosubscription flag for notifications. Optional. Default value is true.
bClearCommonTag Optional. Default value is true.

* - SONET_ROLES_OWNER, SONET_ROLES_MODERATOR, SONET_ROLES_USER - names of constants.

The method supports user fields. User field values are passed the same as the standard fields, for example: "UF_TEXT_1"=>"xxx".

Returned value

The method returns an updated group ID or returns false in case of an error.

Examples

<?
$arFields = array(
	"NAME" => $_POST["GROUP_NAME"],
	"DESCRIPTION" => $_POST["GROUP_DESCRIPTION"],
);
if (!CSocNetGroup::Update($ID, $arFields))
{
	if ($e = $GLOBALS["APPLICATION"]->GetException())
		$errorMessage .= $e->GetString();
}
?>


© «Bitrix24», 2001-2024
Up