I'll try to be as concise as possible here:
I'm using HypeAlive 1.9.0.2 with the adequate HypeFramework installed. Now, comments were working by default on messageboard posts, but not on thewire posts.
In mod/hypeAlive/views/default/framework/comments/forms.php the variables depicted at the top are:
$class = elgg_extract('class', $vars);
$comment_guid = elgg_extract('comment_guid', $vars, false);
$comment = get_entity($comment_guid);
$container = elgg_extract('entity', $vars, false);
on line 14 there is this:
if (!elgg_is_logged_in() || !$container || !$container->canComment()) {
return true;
}
I've played around a bit with it, and actually got it working to this point: If a user is logged in and is friends with the owner of the content, they are allowed to comment on it (including wire posts) I've changed the variables to:
$class = elgg_extract('class', $vars);
$owner = get_entity($comment->owner_guid);
$comment_guid = elgg_extract('comment_guid', $vars, false);
$comment = get_entity($comment_guid);
$user = elgg_get_logged_in_user_entity();
$container = elgg_extract('entity', $vars, false);
And I've changed line 14 to:
if (!elgg_is_logged_in() || !check_entity_relationship($user->guid, 'friend', $container->owner_guid)) {
return true;
}
This allows all logged in users who are friends with the owner of the content to comment on it, however I'd also like to pass a condition that if the logged in user is the owner of the content, they can comment on their own stuff. Any ideas? It's probably a pretty simple thing that I'm missing.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Matt Beckett@Beck24
Matt Beckett - 0 likes
- Nick Germaine@nickgermaine
Nick Germaine - 0 likes
You must log in to post replies.What you should be doing is hooking into the check for 'permissions_check:comment'
http://reference.elgg.org/ElggEntity_8php_source.html#l00972
eg.
Ahhhh thank you so much. I didn't really know what a hook was for. Been messing around with elgg for a little bit, but never got too deep into it. Thank you. So I'll change the forms.php file back to how it was originally, and then try modifying the hook. Thanks so much!