You cannot execute functions in the course context (course id:522). The context error message was: Course or activity not accessible.
More information about this error