Moodle: Pass username to php page for redirect to student folder

Many schools allow students full control over a network folder so that they can create resources such as websites for display to parents etc.
It is useful to be able to create links to these resources so that students, staff and parents can access thenm without having to remember the specific URL.

Within a moodle course
  • Add a recource:  Link to a file or website
  • Location: URL of php file
  • Display Advanced:   variable name:  user;   Choose parameter: user - id
redirect-to-eportfolio.php

<?php
$passed_from_url = $_GET['user'];

$destination_string ="https://www.school..com/students/"+$passed_from_url+"/default.htm"
header( $destination_string ) ; 
?>

No comments:

This post contains some responses to questions that I have been asked by various people over the last few years. In most cases, I have also posted the information on relevant online community forums such as moodle.org. I hope that you find this useful. Stephen Digby