I have looked at your code on git hub. I am new to this and code development. When you say copy/paste where in the enrol\cohort\lib.php file do you paste your code? Did you put it at the end or in a specific location within the file? Any assistance you can provide would be truly appreciated. Thanks!
You can download and replace your files by this files:
But be careful ! This modifications are only tested on Moodle 3.3. So you must use Moodle 3.3
If you use another version, it may doesn't work or even broke your enrolment pages.
If you are interested by this feature, maybe you should add a comment and vote for this issue.