diff --git a/cashier.php b/cashier.php index 703a0b8..c343f57 100644 --- a/cashier.php +++ b/cashier.php @@ -46,12 +46,8 @@ shopping_cart::buy_for_user($userid); } -// We use our output class, but only need the generated array. -$cashier = new cashier($userid, true); -$data = $cashier->returnaslist(); - // Setup the page. -$PAGE->set_context(\context_system::instance()); +$PAGE->set_context($context); $PAGE->set_url("{$CFG->wwwroot}/local/shopping_cart/cashier.php"); $PAGE->set_title(get_string('cashier', 'local_shopping_cart')); $PAGE->set_heading(get_string('cashier', 'local_shopping_cart')); @@ -62,7 +58,10 @@ // Output the header. echo $OUTPUT->header(); -$context = context_system::instance(); +// We use our output class, but only need the generated array. +$cashier = new cashier($userid, true); +$data = $cashier->returnaslist(); + if (has_capability('local/shopping_cart:cashier', $context)) { $data['additonalcashiersection'] = format_text(get_config('local_shopping_cart', 'additonalcashiersection')); }