Moodle plugins directory: Coupon | Moodle.org
Coupon
SEBSOFT COUPON PLUGIN
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.
- WARNING:
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.
This means the PNG images should _always_ be stored as 24-bit true colour images.
_Do not use 32-bit_ (true colour + transparency)!
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.
INSTALLATION INSTRUCTIONS
- 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!
PLACEMENT OF THE PLUGIN
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.
GENERAL CONSIDERATIONS
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).
& also is there a way to fix the issue with printing persian alphabet? It shows ????? in the pdf instead of text.
Sincere Regards
The texts printed on the PDF can be adjusted through the language files (please use the language customisation tool in Moodle).
So far, we've not tested persian/fa languages, but we are familiar with the challenges (unfortunately it doesnt work "just" out of the box in this case).
It should be a somewhat simple enough fix, at least to get the characters to print correctly. I'll look into it. You can pass me a personal email if you're willig to help out with testing (find it in de source code or just pass a note through the github repository).
Cheers,
Rogier
This contains a number of fixes to how errors are displayed if something went wrong with the QR code or the coupon was already used.
Furthermore, we've added a new feature which allows you to process signups via Coupon, even if site wide signups are disabled (this feature is disabled by default).
Cheers! Sebastian
is there a way to use the same coupon code for a defined number of users subscription (example same coupon code for 90 uesers) ?
Fo now this is not possible. It's been on the roadmap for a while but simply haven't had the time (nor funds) to implement this feature (it requires an extensive rewrite due to the fact the database model and code needs to be changed. Coupon codes, upon claiming, are linked to the person who claimed it one-on-one; it would need changing to a one-to-many relationship which requires quite a substantial code overhaul).
Cheers, Rogier
is there a way to capture the coupon creation event via webhook?
Users are now expiring however (enrollment set to one year) and the users are still listed as participants in the course but now have a status of "not curret" (so far so good)
We have now issued new coupons to those users. When they login, and enter their coupon is says it is invalid.
Is there something we need to do or a correct workflow for issuing a second coupon (to renew access) to allow a users/groups to re-enroll in a course?
Thanks
Also it can be important to know what type of coupon you're using (cohort type vs course type).
There's a range of potentials errors that can be thrown so to be able to pinpoint the issue and provide a valid answer it'd be great if you can provide me with that information.
Cheers
Not sure if a webhook is wanted, but you can send me a message explaining the need for a webhook.
If easier, we can always add an event. However: this might impose a processing challenge because when you'd generate a big amount of coupon codes, dispatching events for every code generated could, momentarily, severely impact your processing power and availability of your installation.
Having said that, because coupons are always generated in "batches" (one run implies one batch), it's also possible to implement an event that would only trigger once: when the batch is complete. Given the identifier of the batch it will translate to a collection of coupon/voucher codes.
The coupon block works fine in Moodle4 but just wondered: how can I get the admin reports section to fill more of the screen? With the new layout it's a bit squashed in the middle of the screen with loads of empty screen space where the collapsed drawers are. I would prefer to see the output fill the available screen space. I've had a look at the .css but can't figure out what needs to change to take advantage of the Moodle 4 layout. Any thoughts? I'm more than happy to share any solution I come up with but not sure where to start! Many thanks.
Thanks for your message. I was already thinking the new Moodle layout would more or less interfere (we're sure not the only ones).
Any solution or idea towards a solution would be helpful. It would be ideal if any idea would be filed in the issue tracker, but should you lack a github account, you can always find my email in the plugin files (I've transferred your question to the tracker already btw).
I'm a little short on time now and in the near future so unfortunately I can't facilitate instant improvements; but I already have a few ideas that might work.
A nice thing to know would be if you are working with a highly specific and/or customized Moodle theme or one of the defaults (targeting any solution towards the default theme is easier than targeting highly specifc themes). If you could provide an answer to that it'll be much appreciated.
It's on the radar now so a solution can be expected in some future release (hopefully sooner rather than later).
Cheers, Rogier
I'm working with the Boost theme since I think the same as you: easier to work with the default for now. Thank for your reply and I'll certainly share any progress I make in the issue tracker on github. I'm not a CSS expert so it may take me a while to get anywhere but I'll give it a shot!
Thanks for the great work that you and your team are doing. Your plunging is excellent!
It works fine with my site but does not show in my branded moodle app. We want our users to use the app and enroll in courses or cohorts, which is crucial to our work. Is there anything you can do for us? I will appreciate any help you can provide.
Thanks,
Sekou
Moodle version: Moodle 3.11.5+ (Build: 20220303)
I have installed the Coupon plugin but it is not showing under the Add Block window but i can see it under administration - Block menu
I have uninstalled and re-installed and Purged cache as well
Is there a setting I am missing?
Thanks
The description of the plugin, under section "Placement of the plugin" states there are only two places this plugin actually makes sense at all: the frontpage and the /my page.
Does this resolve your issue?
Cheers.