How automatically unenroll a students after specific days?

How automatically unenroll a students after specific days?

by Hiten Patel -
Number of replies: 9

Hi Mate

I am using moodle 3.4.2   .

I have successfully setup my courses in moodle and I am using thridparty (ontraport) as well for selling my moodle courses. 

Procedure is as follows:

1) When user purchase course from thridparty (onrtaport) then after successfull purchase I inserted that user in moodle via webhook so that user successfully inserted in moodle along with specific course access that is correct for me.


Requirements:
But I want that after 90 days course access should automatically remove from the users 
and also I want that how user can request for re-enroll into course and how can i do that.


Thanks in advance to take me out from this problem.



Average of ratings: -
In reply to Hiten Patel

Re: How automatically unenroll a students after specific days?

by Colin Fraser -
Picture of Documentation writers Picture of Testers

I am pretty sure you can set that up in your cron. The cron is a regular run code that should be able to run an SQL statement to allow you to calculate the days from the date of enrollment and when it reaches 90, the enrollment is reset to unenrolled. Should be OK if a bit tricky to code it. 

In reply to Colin Fraser

Re: How automatically unenroll a students after specific days?

by Hiten Patel -

Hi Colin

I have set up the cron like this  /usr/bin/php http://your.moodle.site/admin/cron.php at cpanel

but still not working course access functionality at my end so can you please let me know is this only one cron I need to setup or there is more cron need to setup .

can you please elaborate few more in simple steps.


Thanks for coming across to this topic to help me.

In reply to Hiten Patel

Re: How automatically unenroll a students after specific days?

by Hiten Patel -

Hi Colin

Do you have any idea that which cron run for auto unenroll from  course ?

I saw in my moodle site here https://www.example.com/admin/tool/task/scheduledtasks.php

there is sheduler set so i think there might be any cron job which is not running for me to unenrolling user from course.

I have attached a screenshot can you please check and let me know which cron should work for unenroll.

Thanks

In reply to Hiten Patel

Re: How automatically unenroll a students after specific days?

by Hiten Patel -

Hi can you please  see my attachements and help me now this will clear to you what i want actullay

I want after one days user should unenroll automatically marked. but now it is not working .

automatically after 1 days marked checked.



Attachment Course completion.png
In reply to Colin Fraser

Re: How automatically unenroll a students after specific days?

by Hiten Patel -

Hello sir


Currently using moodle 3.6 version

I have setup manual enrollment method and set user enrollment for 1 days but after 1 days completed I saw that user still able to access course it is not working for me and also user not getting notification email is there any cron should missing if yes please let me know the name for this functionality.

for manual enrollment this below cron is running

Manual enrolment send expiry notifications task\enrol_manual\task\send_expiry_notificationsManual enrolmentsEdit task schedule: Manual enrolment send expiry notifications taskMonday, 21 January 2019, 4:40 PMMonday, 21 January 2019, 4:50 PM*/10****0Yes
Manual enrolment synchronise enrolments task\enrol_manual\task\sync_enrolmentsManual enrolmentsEdit task schedule: Manual enrolment synchronise enrolments taskMonday, 21 January 2019, 4:40 PMMonday, 21 January 2019, 4:50 PM*/10****0Yes


I have thousands of user who has a access of the course for example ABC and I want that user should not be access to that course after specified days from the enrollment time.

You can see screenshot what I have setup .

In reply to Hiten Patel

Re: How automatically unenroll a students after specific days?

by Colin Fraser -
Picture of Documentation writers Picture of Testers

Hi Hiten, sorry for the delay in responding, but I have not had much experience in using a cron in cpanel. The IT guys won't let me near their server environments, so I have always told them what I want and they set it up for me. There is an automated process to activate the different cron tasks at the required times, and I understand it is done via cPanel > Advanced > Cron Jobs. You can add a new task there and the cron should run using cPanel's APIs, but beyond that, I have no idea how that happens.  Sorry I cannot be of any further assistance. 

In reply to Hiten Patel

Re: How automatically unenroll a students after specific days?

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
In reply to Visvanath Ratnaweera

Re: How automatically unenroll a students after specific days?

by Hiten Patel -

Hello Visvanath Ratnaweera

Thank you for helping but  this plugin is no more useful for me.

I have setup cron but it is not being worked for me. so do you have any idea about cron which run everyday and confirm that course dates is expire for user so after 90 days user should not able to access the course.


Please any help if you can

In reply to Hiten Patel

Re: How automatically unenroll a students after specific days?

by Carl Medley -

Hiten -

Hello! I'm also using Ontraport and Moodle.

Can you share the code for the web hook and install process that allowed a user to purchase a course from Onrtaport, then after successful purchase, Ontraport automatically inserted that user in Moodle via web hook so that user successfully inserted in Moodle along with specific course access that is correct.


Thanks, 

Carl