Restricting Access to URL in course

Restricting Access to URL in course

by philipp lesmana -
Number of replies: 0

Hi,


I have Moodle loading a URL (.php) in the course.

Initially, anyone can access the .php, by hotlinking to the url. however, after adding .htaccess file in the directory, and the following line :

require_once('../config.php');
require_login();

The URL now requires users to log in prior to being able to access the URL. However, I would like to go further and allow only users enrolled in the class to be able to see the URL.

I have a feeling that I need to use


is_enrolled();
method, however i am not quite sure how to actually call it. Can someone give me an example or the code required?

Thank you,


Phil

Average of ratings: -