public function canComment($user_guid = 0, $default = null)
{
$result = parent::canComment($user_guid, $default);
if ($result !== null) {
return $result;
}
if ($user_guid == 0) {
$user_guid = _elgg_services()->session->getLoggedInUserGuid();
}
// must be logged in to comment
if (!$user_guid) {
return false;
}
// must be member of group
if (elgg_instanceof($this->getContainerEntity(), 'group')) {
if (!$this->getContainerEntity()->canWriteToContainer($user_guid)) {
return false;
}
}
// no checks on read access since a user cannot see entities outside his access
return true;
}