What is Token Enrolment?
This Moodle plugin set lets you issue short text “tokens” that represent in a particular course. This is a little different to just setting a password, as a seat may be single use or be able to be re-used up until a certain cap.
This system is actually made up of four different Moodle plugins:
The Auth plugin (source) which is an optional logon form that allows users to self-register and use a token to enter a course directly after logon The Manager plugin (source) is a required block plugin that lets managers create and view token usage The Enrolment plugin (source) is a required plugin that does all the hard work The Web Service plugin (source) is an optional local plugin that can generate tokens via a web service call (required for WooCommerce integration).
These are all bundled together in the GitHub repository.
If you find a problem with the Moodle portions of this plugin and you have a GitHub account, please log the issue directly through the GitHub issue tracker. If you do not have a GitHub account, then you can also use the CourseSuite HelpDesk (no signup needed).
If you have suggestions on how to improve integrations with e-commerce platforms such as WooCommerce and MarketPress, please use the GitHub issue tracker or CoureseSuite forum. Plans for a customised verison of WooCommerce 3.0 that supports selling a user-selectable amount of tokens are on my whiteboard until further funding/time is available.
This plugin is Open Source and parts are based on the MIT / GPL3 license.
o install the plugin you will need access to your Moodle server’s file system, such as through a sftp client or your web hosts dashboard. After downloading the latest source code from GitHub, unzip the package and you’ll find four folders. These need to be uploaded to to corresponding locations within your Moodle installation. It’s best to do this all in one go when there’s no users on your Moodle site (other than yourself as the Administrator).
Next, as your Moodle administrator account, click on Site Administration > Notifications to trigger the plugin installation. Let this run through and just continue past any configuration screens as you see fit.
If you’re a developer, you might like to implement a form that lets your existing users enter a token (such code could be used in a html block or custom registration page). Here’s some code to get you started:
If you want to sell places in your courses, you could of course use the WordPress to Moodle plugin if it were a single place. However it’s possible to sell a list of seats that are generated on demand using WooCommerce (and should work in MarketPress too). It uses a similar method to the WordPress to Moodle system which uses a special text file shim as a downloadable product that identifies details about the tokens that you want to generate.
First, enable web services for your Moodle site (Site Administration > Advanced features), then enable the REST protocol (Site Administration > Plugins > Web Services > Manage Protocols), and finally generate a web service token for the administrator or a specially-made account (Site Administration > Plugins / Web Services > Manage Tokens : then Add).
You’ll get a long alphanumeric value, which will be useful in the next step.
Second, download and install the wooMoodleTokenEnrolment plugin into your WordPress site. Make a plain text file called yourname-wmte.txt (must end with
-wmte.txt) and enter at least a course value (one value per line). Possible values are:
- course: the IDNUMBER of the course in Moodle (this is NOT the row id)
- cohort: the IDNUMBER of the cohort in Moodle that users of this token will be added to (created automatically if it’s not found). See the plugin README for more info …
- seats: the actual number of tokens you want to generate, from 1 to 500 (default: 1)
- places: the number of times each token can be used, from 1 to 500 (default: 1)
- expiry: a unix_timestamp which represents the date that the tokens are no longer considered valid (default: zero for never)
- prefix: a 0-4 letter prefix you want your tokens to start with (default: empty)
Your file should look something like this:
course=myCourse2 seats=10 prefix=free
Upload this to your stores Product page as a virtual downloadable product.
You are strongly urged to set the
Download Limit and
Download Expiry to 1 so the customer doesn’t re-generate the tokens multiple times, as well as setting
Sold Individually so that there is no quantity option.
The first thing you’ll have to do is enable tokens as an enrolment provider for the courses you want to allow enrolments to take place using this provider. As an appropriate account, enter the course and edit the Enrolment methods for that course.
Add “Token Enrolment” as a provider to the existing enrolment methods. Configure the plugin as you see fit (use the help icons for further explanations).
Note: this plugin will automatically also include “Manual enrolments” if it is not available or enabled.
The second thing you’ll need to do is generate some tokens, and to do that you’ll need to drop in the Token Manager block. As your Administrator account, edit the front page or dashboard and add an instance of the Token Enrolment block using the standard Moodle controls.
Note: The screens shown here were captured in Moodle 3.1.1 but are similar other Moodle versions.
You now have a block the the token manager (you can turn editing off again now).
Click on ‘Create new enrolment tokens’ and select a course that you want to work with. Important: this will only show courses that allow enrolments using the Token provider – make sure you’re perfomed step 1 on each course you want to allow it for.
Next, choose whether to generate the tokens for an existing [system] Cohort or create a new cohort for grouping token-enrolled users together. Each of the options in the generation screen have a corresponding Moodle help page, so click on the question mark icon to review the notes for each setting.
Login to access apps.
When you purchased an app we sent you a password so you can log in. Leave the field empty if you can't remember it and we will send you a new password to use.
You'll remain logged on until you log off (uses a cookie).