Commit a9b7e9b3 authored by Aaron Wells's avatar Aaron Wells
Browse files

Reload institution blogs page to get institution's real name

Bug 1520067

behatnotneeded

Change-Id: Ib5943225f48fbacc96986397eb34b94c9db4047b
(cherry picked from commit c2d60a96)
parent 5effbc71
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -43,6 +43,19 @@ if ($institution = param_alphanum('institution', null)) {
    }
    else {
        $s = institution_selector_for_page($institution, get_config('wwwroot')  . 'artefact/blog/index.php');

        // Special case: institution=1 means "any institution".
        // If it comes back with a different institution than that,
        // then reload so we know the institution by name.
        // (This makes pagination a lot easier!)
        if ($institution == 1 && $s['institution'] != 1) {
            if (empty($s['institution'])) {
                // we have no institutions yet (only 'mahara')
                $s['institution'] = 'mahara';
            }
            redirect($CFG->wwwroot . 'artefact/blog/index.php?institution=' . $s['institution']);
        }

        $institutionname = $s['institution'];
        if (!($USER->get('admin') || $USER->is_institutional_admin())) {
            throw new AccessDeniedException();