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.
318 sites
30 fans
280 sites
59 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


  • Logo Sebsoft
    Mon, Jan 7, 2019, 5:21 AM
    I've send you a private message...
  • Picture of ob kofi
    Wed, Jan 9, 2019, 4:11 AM
  • Picture of ob kofi
    Wed, Jan 9, 2019, 4:24 AM
    Please i cant read the message, i have used all my browsers but messages is blank. So here is what i want ok. I want my student to enroll into courses using a voucher. I am already using the coupon plugin by sebesoft. But my students find it difficult in locating and loading the voucher. SO i want an app that will be installed on the students phone which will make it easier for them to load the voucher. SO this is how the app will work

    I generate coupons and sell it to a student. the student opens the app. He receives the welcome message, and a bold field Load Coupon. student clicks on load coupon next page will ask for username, student types username and click continue, the app communicates with the moodle website and fetch the users name and school. if the user details is correct, the user click continue, the next field ask the user to load coupon, he will enter the coupon code he bought and click submitt. The app communicates with the moodle site and enroll the user to the courses associated with the coupon. next page is confirmation page. it will tell the user, submission is successful, then list the courses activated and enrollment duration with expiry date.

    I dont know how you will do it, but i should have a backend where i can generate coupons just like in moodle. that page should give me statistics of the number of coupon generated, the number of coupon used, number of unused coupons. Also i should be able to view the coupon used by a specific student. in case there is an error or a duplicate coupon, i should be able to fetch the student that used a particular coupon. Also when a students enrollment expire, i want the system to remove him from the course so that he can buy a new coupon. sebisoft coupon uses enrollment extension, but i dont want that feature. unroll a student when enrollment expires, so that he can use a new coupon to enroll

    if you can integrate sms notifications, i will be very happy. if you can do it send me a an email at because my moodle messages dont open. I Have sent a message to sebisoft on their website but no reply.Thank you. If you need further details, please let me know
  • Picture of ob kofi
    Thu, Jan 24, 2019, 7:15 PM
    Hi, i will pay for this customization. You have not responded to my message yet.
  • Picture of stephane jacques
    Sun, Jan 27, 2019, 3:02 AM
    Thanks Sebastien for your answer, now i can change the text inside my template, but how to i change the dispay? If I want to move a paragraphe or even a bloc inside the template ? In other words how can I change the display ? thank you very much Sebastien
  • Picture of Harold Buck
    Fri, Feb 1, 2019, 2:53 AM
    Okay, I managed to get everything up and running, but I have an issue. What I would like to do is have one coupon code I can put into a training guide, so that anyone who has that code can register. is there a way to make a coupon code good for multiple (in this case 200) uses? I am not seeing that as an option. I thought I had seen that before, but I might be conflating it with aMember.
  • Logo Sebsoft
    Wed, Feb 6, 2019, 5:37 AM
    Hi everyone,
    @Ob: We've send you an e-mail on all adresses we have.

    @Stephane; Moving blocks inside the template is not supported at this time, it's buildable, but would require customisation.

    @Harold: One code good for 200 uses? - I don't think that's currently a feature. It is a feature for the ClassicPay plugin, but not for Coupon at this time. I don't know if a discount coupon with 100% discount in the enrolment methods ClassicPay would solve your issue, as no actual payment is required for that. Will that work for your case?
  • Picture of Wrina Iamwe
    Thu, Feb 7, 2019, 10:06 AM
    Moodle Version: 3.6
    I received the following error:

    Error/block coupon/error:unable to enrol

    This page does not exist yet. You can search for this page title in other pages, or let us know by posting about it in one of the Moodle community forums.
  • Picture of Rogier van Dongen
    Fri, Feb 8, 2019, 12:58 AM
    Hello Wrima,
    Can you confirm for us that, for the course(s) you've generated the coupons for, a manual enrolment instance is actually available, enabled and correctly configured?
    This is the most common mistake that seems to be made when making use of this plugin.
    Thanks in advance.
  • Picture of Franky Just
    Sat, Feb 16, 2019, 8:53 PM

    If one is using the workaround for adding a coupon field for signing up to Moodle, this signup page is or can't be styled in the layout of the used theme. When one wants to have a styled page you have to hack the file signup.php and add some div's and classes. Is it possible for future development to build in an option to style the signup page?
  • Picture of Franky Just
    Sat, Mar 2, 2019, 2:41 PM
    I have a suggestion for a possible improvement of this very nice plugin. When you want to generate pdf's it's only possible to see the end result when sending them actually with mail. It would be nice when there would be an option to show the pdf before sending. E.g. with a button to show the - to be generated - pdf in a modal window. Especially when you are testing with different logo's, or with text-adjustments, this would be very handy.
  • Picture of Rogier van Dongen
    Wed, Apr 3, 2019, 3:29 PM
    New version 4.0.0 is here.
    Please note you *should* really take a solid look at your translation/language customizations files IF you've ever customised any. I cannot stress this enough!
    Lots of translations have been changed, so any customisations should be reset in some cases.
    If you make use of the CSV/manual upload functionality, this is pretty much a requirement.

    Also please note all translators *should* revise the AMOS translations due to massive changes!

    The reason for saying this is because coupons are no longer being sent as an attachment: we've changed functionality to a include download link for the coupons.
    This is due to the fact we've increasingly received issues where the "mail was never sent". However, it often was send but dropped by the mail provider (e.g. gmail wouldnt accept attached files).\
    If any recieved emails still state something about "attachments being included", this *is* a sign you should revise your language customisations because no more attachments are included.

    Please read the release notes/changelog! A lot of smaller issues have been resolved and a massive code overhaul was done.
    In case of any questions: ask!
  • Picture of Pierpaolo Gallo
    Fri, Apr 12, 2019, 12:02 AM
    I would like to update my server to PHP 7.2 and I'm using coupon module.
    Is there anything I shoul kwno before upgrading? is there any known issue?
    Thank you
  • Picture of Rogier van Dongen
    Fri, Apr 12, 2019, 3:27 PM
    Hello pierpaolo,
    As far as we're aware, there are no issues related to a 7.x version of PHP. The new version has been tested both by us and on of our clients, without issues.
    Please do take note of the many changes in the language files if you're going to use anything other than English. If you have any further questions you can always send me a note
  • Picture of Corrine Carter
    Fri, Apr 19, 2019, 8:06 AM
    Thank you! This is exactly what I needed. The added bonus of the plugin grabbing the progress of the coupon user is great! By using the cohort feature, I can keep each companies employees together and then can easily locate progress information for the employer.
Please login to post comments