Plugin events
For developers. JoomElection raises four events for plugins in the joomelection plugin group. Use them to add your own rules without changing the component. A plugin can either subscribe to the events (SubscriberInterface) and read the named arguments, or be a classic plugin with a method of the same name that receives the arguments in order.
| Event | Arguments | Use |
|---|---|---|
onJoomElectionCheckEligibility |
electionId, userId, eligible |
Narrow the electorate. Set eligible to false, or return false, to refuse a voter. It cannot add voters, and it does not change the turnout figures. |
onJoomElectionBeforeVote |
electionId, voterId, isGuest |
Refuse a ballot just before it is saved. Set abort to true (and optionally message to a language key or text), or return false. |
onJoomElectionAfterVote |
electionId, voterId, isGuest |
Informational, after a ballot is saved. The choices are not passed. |
onJoomElectionAfterResultsReset |
electionId, userId, ballotsDeleted, votersCleared |
Informational, after Reset results. |
voterId is the Joomla user id for members and a negative number for guests.
Examples of use: allow only members whose membership fee is paid, log each vote to another system, or send a notice after a reset. Publish your plugin in the joomelection group and enable it.