Hi everyone,
Does anyone have a script that would allow me to extract a list of all the enrolment keys in my Moodle site?
I'm looking for output like:
Course fullname | Course shortname | enrolment key
Thanks,
Mark
Hi,
SELECT `password`,`fullname`,`shortname` FROM `mdl_course`
either in your dbm or php should do the trick!
SELECT `password`,`fullname`,`shortname` FROM `mdl_course`
either in your dbm or php should do the trick!
Sorry, more helpfully:
<?php
header('Content-type: text/csv; charset=UTF-8');
header('Content-Disposition: attachment; filename="enrolmentkeys.csv"');
@require_once('config.php');
echo "fullname,shortname,password\n";
$courses = get_records_sql("SELECT `id`,`password`,`fullname`,`shortname` FROM `mdl_course`");
foreach ($courses as $course)
echo "$course->fullname,$course->shortname,$course->password\n";
?>
<?php
header('Content-type: text/csv; charset=UTF-8');
header('Content-Disposition: attachment; filename="enrolmentkeys.csv"');
@require_once('config.php');
echo "fullname,shortname,password\n";
$courses = get_records_sql("SELECT `id`,`password`,`fullname`,`shortname` FROM `mdl_course`");
foreach ($courses as $course)
echo "$course->fullname,$course->shortname,$course->password\n";
?>
Thanks Rory,
That's exactly what I needed.
Cheers,
Mark
That's exactly what I needed.
Cheers,
Mark