AddToUserGroup
bool CBlogUser::AddToUserGroup( int ID, int blogID, array arGroups = array(), string joinStatus = "Y", int selectType = BLOG_BY_BLOG_USER_ID, int action = BLOG_CHANGE );
Adds a user with ID to arGroups user groups for the blog with blogID. Static method.
Method parameters
Parameter | Description |
---|---|
ID | User ID. |
blogID | Blog ID. |
arGroups | Array of IDs for blog user groups, to which the user must be associated with. Optional. |
joinStatus | Optional. By default - "Y". This parameter temporarily is not used. |
selectType | Specified bu which ID the user must be searched. Possible values:
|
action | Performed action. Possible values:
|
Returned values
The method returns true on success, otherwise returns false, and exceptions will contain errors.Examples of use
<? // add the current user into the groups with ID = 1, 2, 3 of the blog users with ID = 1 $ID = $USER->GetID(); if(!CBlogUser::AddToUserGroup($ID, 1, array(1,2,3), "", BLOG_BY_USER_ID, BLOG_ADD)) { if ($ex = $APPLICATION->GetException()) echo $ex->GetString(); } else { echo 'User ['.$ID.'] is added to the blog user groups'; } ?>
© «Bitrix24», 2001-2024