if (!$courseid) {
        $courseid = $forum->get_course()->id;
    }
    redirect('index.php?id=' . $courseid);
}
if ($back == 'view') {
    redirect($forum->get_url(mod_forumng::PARAM_PLAIN));
}
if ($back == 'discuss') {
    redirect('discuss.php?' . $discussion->get_link_params(mod_forumng::PARAM_PLAIN));
}
// Not redirecting? OK, confirm
if ($cmid || $discussionid) {
    $backurl = $forum->get_url(mod_forumng::PARAM_HTML);
    $out = $forum->init_page($pageurl, get_string($subscribe ? 'subscribeshort' : 'unsubscribeshort', 'forumng'));
    print $out->header();
    print $out->notification($confirmtext, 'notifysuccess');
    print $out->continue_button($backurl);
    print $out->footer();
} else {
    $backurl = $CFG->wwwroot . '/course/view.php?id=' . $courseid;
    $PAGE->set_url($pageurl);
    $PAGE->set_context(context_course::instance($courseid));
    $PAGE->set_heading($COURSE->fullname);
    $PAGE->set_title($COURSE->shortname);
    $out = forum_utils::get_renderer();
    print $out->header();
    print $out->notification($confirmtext, 'notifysuccess');
    print $out->continue_button($backurl);
    print $out->footer();
}