Logging grade access

Logging grade access

by William Mair -
Number of replies: 2

Hi,

I am trying to create a report (using the Custom SQL Queries report, here) that can check which students have viewed their grades/feedback page.

What I would like to do (I think, if someone can think of a better way, I'd be grateful) is write to the log file whenever the grade/report/user/index.php page is accessed and write the id of the course and user who accessed it.

Can anyone tell me where I need to put that in?

Thanks

Average of ratings: -
In reply to William Mair

Re: Logging grade access

by Farhan Karmali -
Picture of Core developers Picture of Plugin developers Picture of Testers

Hi William,

On the grade/report/user/index.php file itself, after the initial checks for capabilities you may add the function

add_to_log($courseid, $module, $action, $url='', $info='', $cm=0, $user=0)

Hope that helps
In reply to Farhan Karmali

Re: Logging grade access

by William Mair -

Perfect, thanks - although I did change it to 

add_to_log($courseid, 'gradebook', 'view', $url='', $info='', $cm=0, $user=0)

for anyone who specifically wants to add in reports for those viewing grades