Blocks: Coupon

Maintained by Picture of Sebsoft Plugins Sebsoft Plugins, Picture of Rogier van Dongen Rogier van Dongen
The Sebsoft Coupon Plugin offers you the possibility to create coupons for various levels of course access. Using a coupon code, users will be enrolled into courses that are attached to the coupon.
264 sites
49 fans


The Sebsoft Coupon Plugin offers you the possibility to create coupons for various levels

of course access. Using a coupon code, users will be enrolled into courses that are attached to the coupon. That way, you can use the coupon system as voucher or vouchering system for your course(s).

There are a few different ways of generating coupons:

- Course level: this means one or more course(s) need to be selected for which the coupon is valid.

  Once the coupon code is entered by a user, he or she will be enroled in every course the coupon

  is attached to.

  A nice extra feature is, when groups are configured for a certain course, you can configure which

  course group the coupon is for. When a user claims the coupon, he or she will be added to that specific

  group in the course. This makes it possible to separate coupon users from regular users.

  You could also make specific course groups every time you generate a batch of new coupons, so there's

  some way of matching a batch of coupons to a group of users. The possibilities are numerous.

- Cohort level: this means one or more cohort(s) need to be selected for which the coupon is valid.

  Once the coupon code is entered by a user, he or she will be added as a cohort member for every

  cohort the coupon is attached to.

  NOTE: When generating cohort level coupons, there is a possibility to "connect" extra courses to

  a given cohort. One MUST know that upon doing this, the courses will at that point be added to

  the cohort enrolment sync. Without knowing this little fact, it could be "unexpected" behavior,

  even though it's a logical step.

Furthermore, coupons can be generated on two "access" levels:

- Personalized. The base of this, is either a CSV is uploaded, or a CSV is given directly in a textbox.

  The needed user information for every coupon to be generated will be the user's name, email address

  and gender.

  These coupons will then be generated and sent off to the appropriate users using a background task.

- Bulk: The base of this is simple: you generate a certain amount of access coupons, which will then

  be emailed to the pre-configured recipient or (if allowed) to an emailaddress that can be freely entered.


  Wherever possible, please use PNG images.

  Also, whenever possible, do NOT use images that have an alpha channel.

  This will MASSIVELY slow down processing time, due to internal conversion of images by TCPDF.

  On our tests, for a 300 DPI image on A4 format (2480 x 3508 pixels) with an alpha channel,

  rendering a single PDF took around 25 seconds. Taking the alpha channel out of the image,

  rendering a single PDF was reduced to around 3 seconds.

  Furthermore, whenever possible, have the coupon generator create a single PDF with all

  coupons (this is only applicable when generating coupons in "bulk" mode). The process of

  generating coupons has been optimized to only "use" the image 1 time when creating any amount

  of coupons in a single PDF. If you choose the option to create a seperate PDF for every coupon,

  the image will have to be rendered for each and every PDF.

  This has 2 major downfalls:

  1. Every PDF will roughly have a slightly bigger size than the image size (in our tests, 350 - 400 kB per PDF)

  2. Every PDF takes the full amount of time to render.

  Effectively, this means the following (using fictitious sizes):

  10 coupons, single PDF -> result is around 400 kB, rendering takes around 3-4 seconds.

  10 coupons, seperate PDFs -> result is around 4 MB, rendering takes around 35-40 seconds.


- Copy the coupon folder to your blocks directory.

- Go to the moodle admin pages (you will probably be confronted with it anyway) and install the plugin

- Configure the main settings for the plugin.

- We're set up for usage!


There are only two pages you can add the coupon block on. This is the site's frontpage

or the user dashboard (my) page. The main reason for this is because the block is the

"frontend" for users to enter their coupon or voucher code.

Administrators and users with the correct capabilities will also see the links to

the coupon administration pages and the coupon generator page.


There's two main configurations to consider when generating coupons.

For course type coupons, this plugin attempts to enrol a user through use of Moodle's

internal function "enrol_try_internal_enrol".

The Moodle documentation shows it will attempt to enrol you using manual enrolment.

For this reason manual enrolment MUST be enabled for these courses.

For cohort type coupons, a user is made a member of a cohort. That's all there is to it.

Surprise though, if you want to actually make a user have access to a course, you

probably want to configure cohort enrolment for the course.

For those paying attention, creating cohort type coupons thus enables a simple

way of enrolling users into multiple courses at once just by configuring the right

cohort enrolments in multiple courses.

That's still not to say course coupons can't be used in a similar way (using meta courses).


Screenshot #0
Screenshot #1
Screenshot #2
Screenshot #3
Screenshot #4
Screenshot #5
Screenshot #6
Screenshot #7
Screenshot #8


Picture of Sebsoft Plugins
Sebsoft Plugins (Lead maintainer)
Picture of Rogier van Dongen
Rogier van Dongen
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of Rogier van Dongen
    Fri, 23 Mar 2018, 9:11 PM
    Hello Gareth,
    I've sent you a message through the messaging system.
  • Picture of Ryan Kellow
    Mon, 26 Mar 2018, 12:18 PM
    Hi Rogier
    So far this plugin is the single most useful thing in our new Moodle instance.

    I was wondering if there is already a way to create a re-usable coupon code in the plugin?
    This way we can have a code that we give out to prospective clients as a demo course, or for courses where generating an individual coupon for each client in impractical.

    We can of course use self-enrolment, however our user testing has shown that having two different ways to enrol in a course becomes confusing. It's much better for us to have your coupon plugin and a generic coupon for the course.

  • Picture of Phuong Hoang
    Thu, 29 Mar 2018, 10:01 AM
    Dear Rogier,
    This plugin's awesome! It would be great if we had more enrolment methods, for instance self-enrolment.
  • Picture of S D
    Wed, 11 Apr 2018, 4:23 PM
    First of all thank you for this Plugin it is working great. I have one issue where a user enrolls themselves via the coupon and then clicks the email confirmation link they receive. They get direct to a page that confirms their registration with a "Continue" button on it. This button then directs them back to a new user registration page which is a bit confusing as opposed to say thier course or the site homepage.

    Is there a way to configure this?

  • Picture of Rogier van Dongen
    Thu, 12 Apr 2018, 6:09 PM
    Dear S D,
    Thanks for your interest in the coupon plugin. Could you inform us on the Moodle version you are using? We've had this exact issue mentioned once before but so far, have not been able to reproduce it.
    I've also sent you a personal message.
  • Picture of Kevin Freeborn
    Fri, 8 Jun 2018, 3:05 AM
    Hi, we have installed ad like the coupon block! We have an {mlang} tag issue. We use the language tags in the course name so it displays for the student in their language (English or French). However, when we generate PDF coupon it displays the course short name including the language tags (i.e. {mlang en}Training Online{mlang}{mlang fr_ca}Formation en ligne{mlang} instead of Training Online and/or Formation en ligne).

    Is there a way to control how the course name appears on the Coupon PDF?

  • Picture of Dustin Brisebois
    Fri, 8 Jun 2018, 5:19 AM
    Please update the version builds

    The version, 3.5 should not reflect the build date of the major release but the date of the code release. This makes it difficult because if you are upgrading the LMS from 3.1 to 3.4 -- you get a "downgrade" error on the plugin because the two build dates are incorrect.

    Because the 3.2.2 has a higher build number (2017092503 than 3.3.1 (2017092501) this creates the problem. The "higher LMS version" should always have a higher build number (even by 1) to ensure the update event triggers.
  • Picture of Rogier van Dongen
    Fri, 8 Jun 2018, 6:05 PM
    @Dustin... we are well aware of this. Therefore the suppoerted Moodle version were limited to Moodle 3.0, 3.1 and 3.2, because this release was never intended to be used past Moodle 3.2
    New Moodle 3.5+ build will be here soon
  • Picture of Anderson Höfelmann
    Tue, 3 Jul 2018, 8:43 AM
    Please, how to make 20% discount in the course value, not 100%?
  • Picture of Alisa Natal
    Tue, 24 Jul 2018, 6:57 AM
    Is there a way to have the start date begin when using the code, rather than when it is generated?
  • Picture of Alisa Natal
    Wed, 1 Aug 2018, 1:39 PM
    What am I missing? I installed this and was able to set up what I wanted in the general settings, but I can't figure out where I go to generate coupons?
  • Picture of Stuart Morrison
    Wed, 8 Aug 2018, 3:28 AM
    Hi, this looks like a great plugin. We have an online language school and we are looking at doing a trial class for students instead of enrolling onto a full course at full price. Do you think this plugin would work for offering 1 lesson? Otherwise I think I would need to enrol students manually onto the course.......
  • Picture of Alisa Natal
    Thu, 13 Sep 2018, 5:41 AM
    Thank you so much, this plugin has worked perfectly and been such an asset! I'm wondering if you have given any consideration to making it so the plugin can be used to purchase coupon codes, so someone would be able to purchase lessons as gifts?
  • Picture of stephane jacques
    Fri, 21 Sep 2018, 6:48 AM
    Hello Rogier,

    Can you tell me how to change the informations inside the coupon ? It seem that we can only change the image of the coupon, but what about the text ?

  • Logo Sebsoft
    Mon, 24 Sep 2018, 3:32 PM
    Hi Stephane,

    Please check the language files for the information that's displayed inside the Coupon smile.
1 2 3 4 5 6
Please login to post comments