Documentation

CForumTopic::CanUserDeleteTopic

bool
CanUserDeleteTopic(
 int ID,
 array arUserGroups,
 int iUserID
);

The method CanUserDeleteTopic thoroughly checks whether a specified user who is a member of a specified group can delete a specified topic.

Parameters

ParameterDescription
ID The ID of the topic which a user wants to delete.
arUserGroups Array of groups whose member this user is. Array of groups of the current user is returned by $USER->GetUserGroupArray().
iUserID The user ID. The current user ID is returned by $USER->GetID().

Return Values

Returns true if the user has all the permissions required to delete a topic, or false otherwise.

See Also

  • CForumTopic::CanUserAddTopic
  • CForumTopic::CanUserUpdateTopic

    Example


    
    <?
    if (CForumTopic::CanUserDeleteTopic($ID, $USER->GetUserGroupArray(), $USER->GetID()))
    {
    	CForumTopic::Delete($ID);
    }
    ?>
    
  • © «Bitrix24», 2001-2024