Przeglądaj źródła

Add "disable_dislike_option" option see BT#15934

Julio Montoya 5 lat temu
rodzic
commit
3bdb2fa6cc
2 zmienionych plików z 19 dodań i 12 usunięć
  1. 16 12
      main/inc/lib/message.lib.php
  2. 3 0
      main/install/configuration.dist.php

+ 16 - 12
main/inc/lib/message.lib.php

@@ -2680,18 +2680,22 @@ class MessageManager
                 'data-group' => $groupId,
                 'data-group' => $groupId,
             ]
             ]
         );
         );
-        $btnDislike = Display::button(
-            'like',
-            Display::returnFontAwesomeIcon('thumbs-down', '', true)
-            .PHP_EOL.'<span>'.$countLikes['dislikes'].'</span>',
-            [
-                'title' => get_lang('VoteDislike'),
-                'class' => 'btn btn-default social-like '.($countLikes['user_disliked'] ? 'disabled' : ''),
-                'data-status' => 'dislike',
-                'data-message' => $messageId,
-                'data-group' => $groupId,
-            ]
-        );
+
+        $btnDislike = '';
+        if (api_get_configuration_value('disable_dislike_option') === false) {
+            $btnDislike = Display::button(
+                'like',
+                Display::returnFontAwesomeIcon('thumbs-down', '', true)
+                .PHP_EOL.'<span>'.$countLikes['dislikes'].'</span>',
+                [
+                    'title' => get_lang('VoteDislike'),
+                    'class' => 'btn btn-default social-like '.($countLikes['user_disliked'] ? 'disabled' : ''),
+                    'data-status' => 'dislike',
+                    'data-message' => $messageId,
+                    'data-group' => $groupId,
+                ]
+            );
+        }
 
 
         return $btnLike.PHP_EOL.$btnDislike;
         return $btnLike.PHP_EOL.$btnDislike;
     }
     }

+ 3 - 0
main/install/configuration.dist.php

@@ -1201,6 +1201,9 @@ $_configuration['required_extra_fields_in_profile'] = [
 // - launch "composer install" to rebuild the autoload.php
 // - launch "composer install" to rebuild the autoload.php
 //$_configuration['social_enable_messages_feedback'] = false;
 //$_configuration['social_enable_messages_feedback'] = false;
 
 
+// Disable dislike button in the social network.
+//$_configuration['disable_dislike_option'] = false;
+
 // Block student's access to the course documents when using the ckeditor "Browse server" button
 // Block student's access to the course documents when using the ckeditor "Browse server" button
 //$_configuration['block_editor_file_manager_for_students'] = false;
 //$_configuration['block_editor_file_manager_for_students'] = false;
 // Show a language flag next to the user picture in the social network
 // Show a language flag next to the user picture in the social network