Skip to content

Commit

Permalink
Update solve #13 capability is checked before plugin is installed on …
Browse files Browse the repository at this point in the history
…Moodle 4.5
  • Loading branch information
luukverhoeven committed Nov 17, 2024
1 parent 4e866d7 commit 07c78ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion classes/hook/before_http_headers.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

use context_course;
use context_system;
use core_plugin_manager;

/**
* Class before_http_headers.
Expand All @@ -50,13 +51,20 @@ class before_http_headers {
*/
public static function callback(): void {

global $COURSE, $PAGE;
global $COURSE, $PAGE , $CFG;

if (isloggedin() === false) {
return;
}

$context = empty($COURSE->id) ? context_system::instance() : context_course::instance($COURSE->id);

// Check if the plugin is installed.
$plugininfo = core_plugin_manager::instance()->get_plugin_info('local_commander');
if (empty($plugininfo->versiondb)) {
return;
}

if (!has_capability('local/commander:display', $context)) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
**/
defined('MOODLE_INTERNAL') || die();

$plugin->release = '4.5.0';
$plugin->release = '4.5.1';
$plugin->maturity = MATURITY_STABLE;
$plugin->version = 2024101002;
$plugin->version = 2024111700;
$plugin->requires = 2015111602;
$plugin->component = 'local_commander';
$plugin->supported = [39, 405];

0 comments on commit 07c78ce

Please sign in to comment.