Difference between revisions of "JReviews:Developers Events"

From JReviews Documentation
Jump to: navigation, search
(Created blank page)
 
Line 1: Line 1:
 +
JReviews 3 comes with Events that allow you to extend the functionality of JReviews without having to modify core files.
  
 +
<div class="toclimit-4">__TOC__</div>
 +
 +
 +
= What is an Event? =
 +
 +
An event is an action that typically takes place after some user interaction. Each event can have one or more listeners that react to the event. Unlike [[JReviews:Developers_Filters|Filters]], events do not modify data, they trigger other actions through event listeners.
 +
 +
For example, when a user submits a review, this triggers the "ReviewWasCreated" event. There are several core event listeners that listen for this particular event to:
 +
 +
* Send e-email notifications
 +
* Post the review on Twitter
 +
* Post the review on Facebook
 +
* Post the review to the EasySocial or JomSocial activity streams (Joomla)
 +
* Triggering native Joomla or WordPress events
 +
 +
Event listeners run in syncronously, one after the other, so this can delay the request response time after a user performs an action, especially if any of the events require communicating with external sites like posting to Twitter or Facebook. To improve performance, we developed an add-on that allows queing the listener actions so they can be executed asyncrously, independent of the main program flow. Please refer to the [[JReviews_Queue_Add-on|Queue Add-on]] documentation for more information.
 +
 +
 +
= Using Event Listeners =
 +
 +
With event listeners you can run any code you want after a specific even
 +
 +
'''Joomla'''
 +
 +
<pre>/templates/jreviews_overrides/filters/filter_functions.php</pre>
 +
 +
'''WordPress'''
 +
 +
<pre>/jreviews_overrides/filters/filter_functions.php</pre>
 +
 +
= Available Filters =

Revision as of 15:18, 16 February 2018

JReviews 3 comes with Events that allow you to extend the functionality of JReviews without having to modify core files.


What is an Event?

An event is an action that typically takes place after some user interaction. Each event can have one or more listeners that react to the event. Unlike Filters, events do not modify data, they trigger other actions through event listeners.

For example, when a user submits a review, this triggers the "ReviewWasCreated" event. There are several core event listeners that listen for this particular event to:

  • Send e-email notifications
  • Post the review on Twitter
  • Post the review on Facebook
  • Post the review to the EasySocial or JomSocial activity streams (Joomla)
  • Triggering native Joomla or WordPress events

Event listeners run in syncronously, one after the other, so this can delay the request response time after a user performs an action, especially if any of the events require communicating with external sites like posting to Twitter or Facebook. To improve performance, we developed an add-on that allows queing the listener actions so they can be executed asyncrously, independent of the main program flow. Please refer to the Queue Add-on documentation for more information.


Using Event Listeners

With event listeners you can run any code you want after a specific even

Joomla

/templates/jreviews_overrides/filters/filter_functions.php

WordPress

/jreviews_overrides/filters/filter_functions.php

Available Filters