I've such kind of situation here : I'm login into moodle via SSO(using moodle-auth_userkey) which is working well, now I want to auto enroll a selected course to logged in user and I'm using auto_enrol plugin for this, so there are two condition to enroll course which is.
1. when user logged in : I follow with this one, but all courses (which has an instance of auto enroll) enrolled while I want a specific course to enroll.
2. when loading the course : I followed this one as well with URL http://localhost/rs/course/view.php?id=14 but it shows me "This course is currently unavailable to students", so I showed this course from configuration(unhide) but I don't want to allow them to visible to users already.
Please help me, how can I achieve this.
Thanks.