diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-21 02:35:43 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-21 02:35:43 +0000 |
commit | 0030fe2d63684b6612316b5162d34bfaa5dbfee1 (patch) | |
tree | 187a1d912d73addcbab72cf191b6f81ecc0778c8 /views/default | |
parent | 25587657328ca8b492a497e385a2fc3887925848 (diff) | |
download | elgg-0030fe2d63684b6612316b5162d34bfaa5dbfee1.tar.gz elgg-0030fe2d63684b6612316b5162d34bfaa5dbfee1.tar.bz2 |
fixes #2885 #2569 likes controlled by canAnnotate() with plugin hook
git-svn-id: http://code.elgg.org/elgg/trunk@8382 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default')
-rw-r--r-- | views/default/core/likes/display.php | 2 | ||||
-rw-r--r-- | views/default/core/river/controls.php | 47 |
2 files changed, 26 insertions, 23 deletions
diff --git a/views/default/core/likes/display.php b/views/default/core/likes/display.php index 28ffafcb4..570c4d1ff 100644 --- a/views/default/core/likes/display.php +++ b/views/default/core/likes/display.php @@ -14,7 +14,7 @@ if (!isset($vars['entity'])) { $guid = $vars['entity']->getGUID(); // check to see if the user has already liked this -if (elgg_is_logged_in()) { +if (elgg_is_logged_in() && $vars['entity']->canAnnotate(0, 'likes')) { if (!elgg_annotation_exists($guid, 'likes')) { $url = elgg_get_site_url() . "action/likes/add?guid={$guid}"; $params = array( 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); + } } } |