Comments on: How to Show Moodle Course Stats to Students https://www.greengeeks.com/tutorials/show-moodle-course-stats/ How-to Website Tutorials Tue, 09 Aug 2022 15:22:59 +0000 hourly 1 https://wordpress.org/?v=6.3.1 By: subash https://www.greengeeks.com/tutorials/show-moodle-course-stats/#comment-79535 Sat, 20 Mar 2021 10:11:05 +0000 https://www.greengeeks.com/tutorials/?post_type=ht_kb&p=33163#comment-79535 hi, I’m using moodle 3.8, and code igniter, How to get course completion status for student from moodle to code igniter, here is function used,
public function get_completion_status($courseid, $userid) {
$baseurl = COURSE_URL . ‘/webservice/rest/server.php?’;
$options = array(array(
‘userid’ => $userid,
‘courseid’ => $courseid,
));
$params = array(
‘wstoken’ => ‘TOKEN’,
‘moodlewsrestformat’ => ‘json’,
‘wsfunction’ => ‘core_completion_get_course_completion_status’,
‘userid’ => $userid,
‘courseid’ => $courseid
);
$url = $baseurl . http_build_query($params);
$curl = new curl();
$course_completion = $curl->post($url);
$course_complete_status = json_encode($course_completion);
return $course_complete_status;
}
it throws an error
{“exception”:”webservice_access_exception”,”errorcode”:”accessexception”,”message”:”Access control exception”}

]]>