I use a script for this type of function. The one I use frequently is THIS one. It isn’t free, it’s about $29 for a standard licence, but it does most things that you will most likely need. It allows users to self-register, with or without payment, (PayPal and stripe as standard) The script allows for a variety of uses, including membership groups (maybe specific courses in your case) as well as protected downloads that can be made available to all, some or individual groups, and even individual members. I suggest you take a look at the demo site and the demo admin area at the above link to better understand all the features.
The script itself is installed as a web application on your server and uses PHP and MySQL. It’s simple to set up, but if you need help, the developers will install it for you. Once installed, adding the various bits and pieces to your Sparkle site is a breeze. All the code you need to add to your pages is accessed through the administration area. This is simply copied and pasted into embed widgets in your Sparkle page. In fact, Sparkle is my “go-to” application for creating membership areas using this script - even if the client is using a different platform (such as wordpress, or other website development applications). Essentially, it creates a website within a website that is easy to back-up and maintain independently of a main site. It’s well worth the small fee if you need a full blown members area for your website. A developer licence is available at a higher cost if you want to use the script on several websites.