Vote
Voting events allow plugins to intercept vote operations, calculate custom score weights, perform browser fingerprinting and fraud detection, enrich voter details, validate voting modal inputs, and customize client responses.
onVoteSetScore
Event Class:
\NorrNext\Component\Competition\Administrator\Event\Vote\SetScoreEventContext:
com_competition.voteTriggered In:
VoteModel::setScore()(site)
Description
Allows plugins to analyze the voter's tracking data and dynamically assign custom points/weights to the vote.
use NorrNext\Component\Competition\Administrator\Event\Vote\SetScoreEvent;
public function onVoteSetScore(SetScoreEvent $event): void
{
$entryId = $event->getEntryId();
$trackingData = $event->getTrackingData();
$params = $event->getParams();
$score = $event->getScore(); // ['score' => 1, 'info' => []]
// Assign bonus points based on custom algorithm
$score['score'] = 2;
$score['info'][] = 'Double points weekend';
$event->setArgument('score', $score);
}onVoteSetValid
Event Class:
\NorrNext\Component\Competition\Administrator\Event\Vote\SetValidEventContext:
com_competition.voteTriggered In:
VoteModel::setValid()(site)
Description
Allows anti-fraud and security plugins to analyze the voter's browser fingerprint and flag fraudulent votes (valid = 0).
onVoteBeforeSaveDetails
Event Class:
\NorrNext\Component\Competition\Administrator\Event\Vote\BeforeSaveDetailsEventContext:
com_competition.voteTriggered In:
VoteModel::saveDetails()(site)
Description
Enriches the vote details record with custom geolocation (country, city) or analytics data before saving to #__competition_vote_details.
Vote Details Table Properties:
$id(int) — Primary key$vote_id(int) — Associated vote ID$user_agent(string) — Voter browser User-Agent$language(string) — Browser language$timezone(string) — Browser timezone$platform(string) — Operating system/device platform$scr_res(string) — Screen resolution$canvas(string) — Canvas fingerprint hash$referrer(string) — HTTP referrer URL$timediff(int) — Time in milliseconds from page visit to vote submission$country(string) — Geolocation country$city(string) — Geolocation city
onVoteAfterSaveDetails
Event Class:
\NorrNext\Component\Competition\Administrator\Event\Vote\AfterSaveDetailsEventContext:
com_competition.voteTriggered In:
VoteModel::saveDetails()(site)
Description
Fired after the vote tracking details are saved to the database.
onVoteBeforeDelete
Event Class:
\NorrNext\Component\Competition\Administrator\Event\Vote\BeforeDeleteEventContext:
com_competition.voteTriggered In:
VoteModel::delete()(site unvote or admin vote removal)Cancellable: Yes (returning
falseprevents vote deletion)
onVoteAfterDelete
Event Class:
\NorrNext\Component\Competition\Administrator\Event\Vote\AfterDeleteEventContext:
com_competition.voteTriggered In:
VoteModel::delete()
onVoteModalContent
Event Class:
\NorrNext\Component\Competition\Administrator\Event\Vote\VoteModalContentEventContext:
com_competition.voteTriggered In:
VoteModal::getModalContent()(site)
Description
Allows plugins to inject custom HTML, disclaimer checkboxes, or form fields into the interactive AJAX voting modal dialog.
onVoteModalValidate
Event Class:
\NorrNext\Component\Competition\Administrator\Event\Vote\VoteModalValidateEventContext:
com_competition.voteTriggered In:
VoteModal::validateModalSubmission()(site)
Description
Validates custom inputs submitted via the vote modal dialog before allowing the vote to proceed.
onVoteResponse & onUnvoteResponse
Event Class:
\NorrNext\Component\Competition\Administrator\Event\Controller\VoteResponseEventContext:
com_competition.voteTriggered In:
ParticipantController::ajaxVote()andParticipantController::ajaxUnvote()(site)
Description
Allows plugins to modify the JSON response payload sent back to the browser client upon casting or revoking a vote.
Arguments
$context - the context of the event, ‘com_competition.vote’.
$response - response object holding vote data, response status and response message.
onVoteModalContent & onVoteModalValidate
NorrCompetition allows developers to customize the vote modal dialog — for example, injecting custom disclaimers, GDPR consent checkboxes, or additional form fields, and validating user inputs before casting a vote.
onVoteModalContent(NorrNext\Component\Competition\Administrator\Event\Vote\VoteModalContentEvent): Dispatched when rendering the vote confirmation modal form. Allows adding custom XML form definitions and appending custom HTML content/disclaimers.onVoteModalValidate(NorrNext\Component\Competition\Administrator\Event\Vote\VoteModalValidateEvent): Dispatched upon modal form submission to validate custom inputs (such as mandatory terms acceptance) before the vote is finalized.
Last updated