public function canComment(ElggEntity $entity, $user_guid = 0, $default = null)
{
try {
$user = $this->entities->getUserForPermissionsCheck($user_guid);
} catch (UserFetchFailureException $e) {
return false;
}
// By default, we don't take a position of whether commenting is allowed
// because it is handled by the subclasses of \ElggEntity
$params = ['entity' => $entity, 'user' => $user];
return $this->hooks->trigger('permissions_check:comment', $entity->getType(), $params, $default);
}