MDL-68931 core: No feedback link on footer if the feature is disabled

This commit is contained in:
Shamim Rezaie 2020-06-05 19:48:07 +10:00
parent 71a34a039f
commit 4cdcd23fb2
3 changed files with 49 additions and 2 deletions

View file

@ -96,7 +96,7 @@ class core_userfeedback {
public static function should_display_reminder(): bool {
global $CFG;
if ($CFG->enableuserfeedback && isloggedin() && !isguestuser()) {
if (static::can_give_feedback()) {
$give = get_user_preferences('core_userfeedback_give');
$remind = get_user_preferences('core_userfeedback_remind');
@ -145,6 +145,17 @@ class core_userfeedback {
return $url;
}
/**
* Whether the current can give feedback.
*
* @return bool
*/
public static function can_give_feedback(): bool {
global $CFG;
return $CFG->enableuserfeedback && isloggedin() && !isguestuser();
}
/**
* Returns the last major upgrade time
*