Thanks,
This solves the problem in a neat way.
The way I had handled this was by the dirtiest hack ever like this:
$rolesactive = $CFG->rolesactive; $script = $SCRIPT; $CFG->rolesactive = false; $SCRIPT = "/$CFG->admin/index.php"; add_moduleinfo($data, $course, $mform); $CFG->rolesactive = $rolesactive; $SCRIPT = $script;
But I will change my code to do this is a proper way.