NorrCompetition | NorrNext Documentation
DocumentationNorrCompetition
  • 🚀Getting started
    • Technical Requirements
    • Installation and Updates
  • 🛠️Configuration
    • Component Options
    • General
    • Contests
    • Contest
    • Entries
    • Entry
    • Categories
    • Category
    • Images
    • Comments
    • Contest Form
    • Permissions
  • 🖼️Contests
    • Managing Contests
    • Creating Contest
    • Contest Layout Options
    • Closing Contest
  • 🏆Entries
    • Managing Entries
    • Adding Entry
    • Approving Entry
    • Entry Data Comparison
    • Entry Layout Options
    • Submitting Entry Form
    • Contestant's Profile
    • Votes Log
  • 📂Categories
    • General Information
    • Managing Categories
    • Creating Category
    • Category Layout Options
  • 🧩Fields
    • General Information
    • Managing Fields
    • Field Types
    • Creating Field
  • 🔋Modules
    • NorrCompetition Entries
    • NorrCompetition Contests
    • NorrCompetition Grid
  • 🔌Plugins
    • NorrCompetition Notifications
    • NorrCompetition Smart Search
    • NorrCompetition Search
    • NorrCompetition Sitemap
    • NorrCompetition Profile Link
    • Application for EasySocial
    • NorrCompetition Application for JomSocial
    • AUP plugin for NorrCompetition
    • NorrCompetition Image Moderation
      • Sightengine Setup
      • Plugin Configuration
  • 💬Comments
    • Integration with Facebook
    • Integration with JComments
    • Integration with Komento
    • Integration with Disqus
    • Integration with VK.com
  • ☁️Remote Storage
    • General Information
    • AWS S3
  • 🖥️Customisation
    • Template Overriding
    • Using content plugins on entry page
    • Link to contestant
    • Events
      • Content
      • Contest
      • Entry
      • Entry Form
      • Field
      • Vote
      • Other
  • ✍️Localisation
    • Language pack installation
    • How to take a part in NorrCompetition localisation
  • 📜Best Practices
    • Recommendations on image sizes
    • Use on multilingual sites
    • Tutorial: How to Create Photo/Video Voting Contest on Joomla
    • Tutorial: Monetize Voting Contests via Membership
    • Tutorial: Monetize Voting Contests via Points
    • Embedding HTML snippets on example of music contest
  • 💡FAQ
    • How the protection from unfair voting is implemented?
    • What notifications does the component send?
    • Create and edit contests on front-end
    • Submitting Entries by Unregistered Users
    • How to install sample data
    • How to change the order of tabs with comments
    • Using navigation module (breadcrumbs)
    • NorrCompetition and YOOtheme Pro
  • 🔍Troubleshooting
    • I do not get notifications from NorrCompetition
    • I get an error or white screen on photo upload
    • No images appear after submitting entries
    • Submit button is not working
  • User is not able to vote. Errors in the console
Powered by GitBook
On this page
  • onVoteBeforeDelete
  • onVoteAfterDelete
  • onVoteSetScore
  • onVoteSetValid
  • onVoteBeforeSaveDetails
  • onVoteAfterSaveDetails
  • onVoteResponse
  • onUnvoteResponse
  1. Customisation
  2. Events

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.

public function onVoteSetValid($context, $entryId, $trackingData, $params, &$valid)
{
    // Do some analytics
    $valid = 0;
    
    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. &$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).

public function onVoteBeforeSaveDetails($context, $table, $params)
{
    // Set city to London
    $table->country = 'UK';
    $table->city    = 'London';

    return;
}

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:

/**
 * Vote details table class
 *
 * @property   integer  $id          Primary key
 * @property   integer  $vote_id     Vote ID
 * @property   string   $user_agent  User agent string
 * @property   string   $language    Browser language
 * @property   string   $timezone    User timezone
 * @property   string   $platform    User platform
 * @property   string   $scr_res     Screen resolution
 * @property   string   $canvas      Passed canvas or not
 * @property   string   $referrer    Referrer URL
 * @property   integer  $timediff    Time difference in milliseconds between entering the site and vote
 * @property   string   $country     Country of voter
 * @property   string   $city        City of voter
 */

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.

public function onVoteResponse($context, $response)
{
	if ($context != 'com_competition.vote'
		|| !\Joomla\CMS\Factory::getApplication()->app->isClient('site'))
	{
		return;
	}

	$response->message = 'onVoteResponse is working fine';
}

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.

public function onUnvoteResponse($context, $response)
{
	if ($context != 'com_competition.vote'
		|| !\Joomla\CMS\Factory::getApplication()->app->isClient('site'))
	{
		return;
	}

	$response->message = 'onUnvoteResponse is working fine';
}

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

PreviousFieldNextOther

Last updated 2 years ago

🖥️