Using Apache mod rewrite to change the deprecated parameter "topic" to "section"

Re: Using Apache mod rewrite to change the deprecated parameter "topic" to "section"

by Gareth J Barnard -
Number of replies: 0
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Dear Peter,

I hate to say it, but you did not need to go to the bother as the php code already has in '/course/format/topics/format.php' the code:

// Horrible backwards compatible parameter aliasing..
if ($topic = optional_param('topic', 0, PARAM_INT)) {
$url = $PAGE->url;
$url->param('section', $topic);
debugging('Outdated topic param passed to course/view.php', DEBUG_DEVELOPER);
redirect($url);
}
// End backwards-compatible aliasing..

Which does the job.  I think this was put in by Dan Poltawski as a fallback.  All you need to do in the long term is use the new name and phase out the old when opportunity arises.

Cheers,

Gareth