Vote

onVoteBeforeDelete

onVoteAfterDelete

Description These events are triggered in CompetitionModelVote::delete (site - on unvote; admin - on vote delete). If the plugin returns false for onVoteBeforeDelete event then the vote is not being deleted.

public function onVoteBeforeDelete($context, $table)
{
    // Do something
    return true;
}

Arguments $context - the context of the event, ‘com_competition.vote’. $table - a reference to CompetitionTableVote object.

onVoteSetScore

Description These event is triggered in CompetitionModelVote::setScore (site). It allows to provide own analytics and change the score and information for vote.

public function onVoteSetScore($context, $entryId, $trackingData, $params, $score)
{
    // Do some analytics
    $score['score']  = 1;
    $score['info'][] = 'I do not like you';
    
    // Do more analytics
    $score['score']  = 1;
    $score['info'][] = 'I am still do not like you :)';
    
    return;
}

Arguments $context - the context of the event, ‘com_competition.vote’. $entryId - ID of entry for which the vote is being processed. $trackingData - additional browser tracking data. $params - parameters of the contest. $score - array containing the score and info about the score.

onVoteSetValid

Description These event is triggered in CompetitionModelVote::setValid (site). It allows to provide own analytics and change the validity for vote: 0 - not valid, 1 - valid.

Arguments $context - the context of the event, ‘com_competition.vote’. $entryId - ID of entry for which the vote is being processed. $trackingData - additional browser tracking data. $params - parameters of the contest. &$valid - the validity of the score.

onVoteBeforeSaveDetails

onVoteAfterSaveDetails

Description These events are triggered in CompetitionModelVote::saveDetails (site). It allows to provide own analytics and set own vote details. Also it is possible to set additional data: country and city (does not set by component).

Arguments $context - the context of the event, 'com_competition.vote'. $table - a reference to CompetitionTableVoteDetails object. $params - parameters of the contest.

Below is the list of vote details class properties:

onVoteResponse

Description These event is triggered in CompetitionControllerParticipant::ajaxVote (site). It allows to change the response data send back to user. For example, you can change a message that is displayed to a user.

Arguments $context - the context of the event, ‘com_competition.vote’. $response - response object holding vote data, response status and response message.

onUnvoteResponse

Description These event is triggered in CompetitionControllerParticipant::ajaxUnvote (site). It allows to change the response data send back to user. For example, you can change a message that is displayed to a user.

Arguments $context - the context of the event, ‘com_competition.vote’. $response - response object holding vote data, response status and response message.

Last updated