Documentation

DeleteFromUserGroup

bool
CBlogUser::DeleteFromUserGroup(
 int ID,
 int blogID,
 int selectType = BLOG_BY_BLOG_USER_ID,
);

The method deletes a user with the ID from all blog user groups with blogID. Static method.

Method parameters

ParameterDescription
ID User ID.
blogID Blog ID.
selectType Specifies the ID of the searched user. Possible values:
  • BLOG_BY_USER_ID - search by the site user ID;
  • BLOG_BY_BLOG_USER_ID - search by the blog user ID.
Optional. By default, BLOG_BY_BLOG_USER_ID - search by the blog user ID.

Returned value

The method returns true on success, or false otherwise. Exceptions will contain errors.

Examples of use

<?
// delete the current user from all user groups of the blog with ID = 1
$ID = $USER->GetID();
if(!CBlogUser::DeleteFromUserGroup($ID, 1, BLOG_BY_USER_ID))
{
    if ($ex = $APPLICATION->GetException())
        echo $ex->GetString();
}
else
{
    echo 'User ['.$ID.'] is deleted from the blog user groups';
}
?>


© «Bitrix24», 2001-2024
Up