diff --git a/sources/controllers/Display.controller.php b/sources/controllers/Display.controller.php index bc5736f041..508d0f0600 100644 --- a/sources/controllers/Display.controller.php +++ b/sources/controllers/Display.controller.php @@ -539,6 +539,9 @@ public function action_display() // ajax controller for likes loadJavascriptFile('like_posts.js', array('defer' => true)); + addJavascriptVar(array( + 'likemsg_are_you_sure' => JavaScriptEscape($txt['likemsg_are_you_sure']), + )); loadLanguage('Errors'); // Initiate likes and the tooltips for likes diff --git a/themes/default/languages/english/index.english.php b/themes/default/languages/english/index.english.php index 3daf002e55..2ee87c49df 100644 --- a/themes/default/languages/english/index.english.php +++ b/themes/default/languages/english/index.english.php @@ -709,6 +709,7 @@ $txt['liked_by'] = 'Liked by:'; $txt['liked_you'] = 'You'; $txt['liked_more'] = 'more'; +$txt['likemsg_are_you_sure'] = 'You already liked this message, are you sure you want to remove your like?'; $txt['unread_topics_visit'] = 'Recent Unread Topics'; $txt['unread_topics_visit_none'] = 'No unread topics found since your last visit. Click here to try all unread topics'; diff --git a/themes/default/scripts/like_posts.js b/themes/default/scripts/like_posts.js index 6a6c3a16ee..6fff68ce2c 100644 --- a/themes/default/scripts/like_posts.js +++ b/themes/default/scripts/like_posts.js @@ -43,7 +43,12 @@ // Set the subAction to what they are doing if (check.indexOf('unlike_button') >= 0) + { + if (!confirm(likemsg_are_you_sure)) + return; + subAction = 'unlikepost'; + } else subAction = 'likepost';