Bitrix Site Manager

CForumMessage::CanUserDeleteMessage

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

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

Parameters

ParameterDescription
ID The ID of the message which the 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 permissions required to delete a message, or false otherwise.

See Also

  • CForumMessage::CanUserAddMessage
  • CForumMessage::CanUserUpdateMessage

    Example


    
    <?
    if (CForumMessage::CanUserDeleteMessage($ID, 
                                            $USER->GetUserGroupArray(), 
                                            $USER->GetID()))
    {
    	CForumMessage::Delete($ID);
    }
    ?>