From 4e47bdfffcdca120e389a0e1c6793e568ddfe65a Mon Sep 17 00:00:00 2001 From: Thorsten Eurich Date: Fri, 5 Jul 2013 18:40:54 +0200 Subject: [PATCH 1/3] missing global. Signed-off-by:Thorsten Eurich --- sources/controllers/Markasread.controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/controllers/Markasread.controller.php b/sources/controllers/Markasread.controller.php index a254af1fc1..d97742e7d1 100644 --- a/sources/controllers/Markasread.controller.php +++ b/sources/controllers/Markasread.controller.php @@ -63,7 +63,7 @@ private function _dispatch() */ public function action_index_api() { - global $context, $txt, $user_info; + global $context, $txt, $user_info, $scripturl; loadTemplate('Xml'); From 9612c8a869c0d1d289baa6be7f5dc4e5cdb0d232 Mon Sep 17 00:00:00 2001 From: Thorsten Eurich Date: Fri, 5 Jul 2013 18:42:21 +0200 Subject: [PATCH 2/3] unused globals. Signed-off-by:Thorsten Eurich --- themes/default/Display.template.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/default/Display.template.php b/themes/default/Display.template.php index 88b7f66e05..4d7b471272 100644 --- a/themes/default/Display.template.php +++ b/themes/default/Display.template.php @@ -916,7 +916,7 @@ function template_display_calendar_above() function template_pages_and_buttons_above() { - global $context, $txt, $modSettings; + global $context; // Show the anchor for the top and for the first message. If the first message is new, say so. echo ' @@ -928,7 +928,7 @@ function template_pages_and_buttons_above() function template_pages_and_buttons_below() { - global $context, $txt, $modSettings; + global $context; // Show the page index... "Pages: [1]". From fe52ebdfdeaca80904f4e37f1fb00f01820a6bf2 Mon Sep 17 00:00:00 2001 From: Thorsten Eurich Date: Fri, 5 Jul 2013 19:28:09 +0200 Subject: [PATCH 3/3] fixes for various undefined index errors: - the "like" button alternate text can't show show users if no one had liked the message before - the "like" button shouldn't appear if the "like" feature is disabled. Signed-off-by:Thorsten Eurich --- sources/controllers/Display.controller.php | 1 + themes/default/Display.template.php | 19 ++++++++----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/sources/controllers/Display.controller.php b/sources/controllers/Display.controller.php index 53d782bfa8..1989936ead 100644 --- a/sources/controllers/Display.controller.php +++ b/sources/controllers/Display.controller.php @@ -1043,6 +1043,7 @@ public function prepareDisplayContext_callback($reset = false) 'can_like' => $message['use_likes'] && !$message['likes'], 'can_unlike' => $message['use_likes'] && $message['likes'], 'like_counter' =>$message['like_count'], + 'likes_enabled' => !empty($modSettings['likes_enabled']) ? true : false, ); // Is this user the message author? diff --git a/themes/default/Display.template.php b/themes/default/Display.template.php index 4d7b471272..4a97ec68b5 100644 --- a/themes/default/Display.template.php +++ b/themes/default/Display.template.php @@ -213,31 +213,28 @@ function template_main() '; } - // Has anyone liked this post? @todo - Still needs a bit of tweaking. - //if (!empty($message['like_counter'])) + // Hide likes for those who can't like or unlike for now.. + if ($message['likes_enabled']) + { echo ' -
  • '; +
  • '; - // Can they like this post + // Can they like this post? if ($message['can_like']) - { - echo ' + echo ' '; - } // Or remove the like they made elseif ($message['can_unlike']) - { - echo ' + echo ' '; - } echo '
  • '; - + } // Can the user quick modify the contents of this post? Show the quick (inline) modify button. if ($message['can_modify']) echo '