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.
218 sites
42 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, 26 May 2017, 11:45 PM
    Yet Another New Version.

    In this release we added the possibility for enrolment extension coupons on a course level.
    The possibility to create enrolment extension coupons is available from the course administration menu (added as a new menu item).
    We also added a webservices to generate coupon codes or coupons and request the progress reports.

    In case of questions on functionality, don't hesitate to contact us.

  • Picture of Rogier van Dongen
    Wed, 31 May 2017, 4:33 PM
    Updated to new version.
    This resolves issue #14 where the page, after a successful login, redirects back to the customized signup page after choosing "I already have an account and want to login".
  • Picture of Rekha C
    Tue, 13 Jun 2017, 1:16 AM
    Each coupon pdf has a unique QR code with it. What can i do with the QR code? How can I stop coupons generating QR codes?
  • Picture of Rogier van Dongen
    Mon, 3 Jul 2017, 6:44 PM
    Updated to new version.
    This resolves and issue with cohort enrolment coupons not functioning as intended.
    Added is the possibility to disable including the QR Code in the generated coupons.

    @Rekha: due to lack of time, we have yet to write a comprehensive manual. In short, the QR Code enables the possibility to process the coupon without having to type it in.
    For example; when logged in in Moodle and on a device that can scan the QR Code, this method can be used to instantly scan the QR Code. The coupon code is instantly applied, so users do not have to type it in.
    It also allows users to scan the QR Code and register with your website (providing the user isn't logged in yet). The signup form is the same as the "standard" form, but also has a input field that holds the coupon code. After successful registration, the coupon code for the new user will automatically be processed.
    We're working on a manual to explain all capabilities and processes for the coupon block and hope to have it finished soon.

  • Picture of narutoget shippuden
    Mon, 3 Jul 2017, 7:08 PM
    Really nice article and definitely it will be useful for many people, Rhonda . Kindly keep update like this. I am truly delighted to glance at this blog posts, thanks for providing such information. Narutoget
  • Picture of spyros zoup
    Fri, 14 Jul 2017, 6:24 AM
    Congrats! one of the best Moodle plugins! Do you intend to add discount options when generating coupon instead of the standard 100% off?
  • Picture of Yuri Lima
    Thu, 20 Jul 2017, 5:20 AM
    Hello Rogier van Dongen. Thanks for the plug-in, it's being very useful for me, however I'm needing to give discount coupon when buying courses. For the payment method, I use native PayPal in moodle. Is it possible to do this with this plug-in?
    Thank you very much in advance
  • Picture of Yuri Molina Vale
    Mon, 9 Oct 2017, 10:14 AM
    Dear Rogier,

    Thank you very much for the coupon plug-in. It has been much usefull.

    I'd like to ask you if you could update the plug-in in order to accept the Portuguese (Brazil) language.
    For instance, in the following print you can see the strings "CUPOM" and "Enviar Cupom" in Portuguese, but the string "Please enter your coupon code here:" in English.
    Print screen:

    Is it possible to correct ?

    Thanks for your attention.
  • Picture of Michael Reen
    Sat, 21 Oct 2017, 4:10 AM
    Hey Rogier,
    is it possible to see who (user account) used which coupon (for example AjsjS2jfkasajFJ2) to access the courses?
    If one coupon was stolen, we would be able to deactivate the right account.
    Best wishes!
  • Picture of Rogier van Dongen
    Mon, 23 Oct 2017, 7:01 PM
    Hi Michael,

    You could use the "Used coupons" overview tab along with the implemented filtering capabilities.
    This will provide you an overview of the used coupons/vouchers along withy their code and the user it was assigned to.
    If you'd wish to see extra filtering possibilities (for example a search on specific coupon/voucher codes), please notify me so we can incorporate it in a future release.
    Cheers! Rogier
  • Picture of Rogier van Dongen
    Mon, 6 Nov 2017, 7:57 PM
    New version is here!
    Changes for Version 3.3.0 (build 2017092500)
    * Fixed deprecated pix_url references (replaced by image_url)
    * Minimum required Moodle version: 3.3

  • Picture of Rekha C
    Tue, 21 Nov 2017, 2:14 PM
    The coupon block appears on the home page in the right column and occupies an entire column. How can I move the Coupon block to the footer?
  • Picture of Michael Reen
    Fri, 15 Dec 2017, 6:16 AM
    Dear Rogier,
    how can I notify you -> I wrote you a message on moodle! smile

    Best wishes!
  • Picture of Rogier van Dongen
    Fri, 16 Feb 2018, 9:32 PM
    New version is here!
    Changes for Version 3.3.1 (build 2017092501)
    * Added coupon code to "progress report" for validation purposes (feature request by Michael Reen)
    * Added claimed user to "used coupons" overview for validation purposes (feature request by Michael Reen)

    The additions allow for specific tracking of coupon codes in case this would be needed. For instance if you provide students their own personal code, have this registered somewhere and you want to validate whether or not students do not use someone elses code, the reports can now show this.
    Thus, In the aforementioned reports you will now find both the person who was claimed the coupon code as well as the code used.

    Do note: this is only available for Moodle 3.3 and onwards. There's no plans as of yet to backport this to older versions.
  • Picture of Phuong Hoang
    Sat, 17 Feb 2018, 1:38 PM
    Dear Rogier van Dongen,
    As I commented 2 years ago "Sun, Jan 3, 2016, 8:18 AM", Is it possible for registered users and guests to have a look at what activities and resources I have in a course first? If so, customers will be more persuasive before buying a course. A brief preview in the main course page not just a course summary.
    * P/s:
    + Most payment gateways just give a link of the course and it's hard for course creators to buy. I hope your plugin will be different.
    + Just the same as when a guest access to a course, he/ she can see quizzes, assignments, forums...However, when he/ she hits the links, moodle will appear the popup to register or to enter the coupon code to continue (available in moodle)
    Kind regards,
1 2 3 4 5
Please login to post comments