Let's say, in my self-registration plugin I need to issue the badge when the user is registered. It's easy to implement, just create a badge, put its id in my plugin settings and on registration call {{ $b = new badge($id); $b->issue($userid); }}
But... I can not activate the badge until I set any award criteria. I had to put "manually by Manager" but it is now displayed everywhere and is confusing for the users.
So, I suggest to add a custom criteria for badges. I can think of two options:
Option 1 (easy) Define a new "Custom" criterion with a text description field that does nothing by itself. 3rd party plugins like mine will take care of issuing this badge.
Option 2 (slightly advanced) Except for the above, add the internal "idnumber" to the criteria. Then plugins will be able to look up badges by their idnumber
Option 3 (difficult but super-flexible) Define a new "On event" criterion. Badge creator will need to choose an event and some other settings or conditions. When event happens the badge is automatically awarded.
In other settings/conditions I can see:
- whether to award the user performing the event or "Related user" from event (for example, in grading and completion events the student is the "related user" and the teacher is the one who grades).
- start and end time (optional) when event happened
- context level of the event (any, system, course, module, course or below)
- [for events with course context level] - option to select a course
- [for events with module context level] - option to select a module
maybe something else but it does not have to be as complicated as event monitor.
For me this would be just super-useful. I could trigger my own events from my plugin when user registration was completed and badge would be automatically issued. It would cover lots of other requests for new badges criteria, such as MDL-47985, MDL-39921. However if MDL-39864 is accepted I'll make it my own plugin instead
tsala, poltawski, do you think something like that would be useful on moodle.org as well?