aboutsummaryrefslogtreecommitdiff
path: root/views/default/core/river/controls.php
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/core/river/controls.php')
-rw-r--r--views/default/core/river/controls.php47
1 files changed, 25 insertions, 22 deletions
diff --git a/views/default/core/river/controls.php b/views/default/core/river/controls.php
index 615da7f96..21ce8414c 100644
--- a/views/default/core/river/controls.php
+++ b/views/default/core/river/controls.php
@@ -11,6 +11,7 @@ $object = $vars['item']->getObjectEntity();
if (elgg_is_logged_in()) {
// comments and non-objects cannot be commented on or liked
if ($vars['item']->annotation_id == 0) {
+ // comments
if ($object->canComment()) {
$params = array(
'href' => '#',
@@ -22,28 +23,30 @@ if (elgg_is_logged_in()) {
}
// like this
- if (!elgg_annotation_exists($object->getGUID(), 'likes')) {
- $url = "action/likes/add?guid={$object->getGUID()}";
- $params = array(
- 'href' => $url,
- 'text' => elgg_echo('likes:likethis'),
- 'is_action' => true,
- );
- echo elgg_view('output/url', $params);
- } else {
- $options = array(
- 'guid' => $guid,
- 'annotation_name' => 'likes',
- 'owner_guid' => elgg_get_logged_in_user_guid()
- );
- $likes = elgg_get_annotations($options);
- $url = elgg_get_site_url() . "action/likes/delete?annotation_id={$likes[0]->id}";
- $params = array(
- 'href' => $url,
- 'text' => elgg_echo('likes:remove'),
- 'is_action' => true,
- );
- echo elgg_view('output/url', $params);
+ if ($object->canAnnotate(0, 'likes')) {
+ if (!elgg_annotation_exists($object->getGUID(), 'likes')) {
+ $url = "action/likes/add?guid={$object->getGUID()}";
+ $params = array(
+ 'href' => $url,
+ 'text' => elgg_echo('likes:likethis'),
+ 'is_action' => true,
+ );
+ echo elgg_view('output/url', $params);
+ } else {
+ $options = array(
+ 'guid' => $guid,
+ 'annotation_name' => 'likes',
+ 'owner_guid' => elgg_get_logged_in_user_guid()
+ );
+ $likes = elgg_get_annotations($options);
+ $url = elgg_get_site_url() . "action/likes/delete?annotation_id={$likes[0]->id}";
+ $params = array(
+ 'href' => $url,
+ 'text' => elgg_echo('likes:remove'),
+ 'is_action' => true,
+ );
+ echo elgg_view('output/url', $params);
+ }
}
}