Events Booking allows you to develop plugins to extend it's features. In fact, it has many plugins come with it by default which you can see in the foldder plugins/eventbooking on your site.
Events Booking supports the following events trigger which you can write plugin to handle to add more features to the extension:
This event is triggered on add/edit event form. It usually used to allows you to display a form to allow admin control the necessary settings for your event. A sample is the Joomla Groups plugin which allows admin to select which user groups registrants of the event will be added to when he registers and make payment for the event.
public function onEditEvent($row)
{
}
This event is triggered after the event is saved to database. It is usually used to save the settings data which you displayed on event add/edit screen so that you can used that settings data later
public function onAfterSaveEvent($row, $data, $isNew)
{
}
This event is triggered after the registration record record is saved to database (before payment is processed)
public function onAfterStoreRegistrant($row)
{
}
$row: The table object (instance of EventbookingTableEvent class) stores information of stored registration record. From $row object, you can access to any fields from eb_registrants table:
$row->id : ID of registration record
$row->event_id: ID registered event
$row->user_id : ID of user who registered for event
$row->first_name: First Name of registrant
$row->last_name: Last Name of registrant
$row->email: Email of registrant
$row->payment_method: The payment method registrant uses to make payment
$row->transaction_id: Transaction ID of payment for the registration.
$row object only allows you to access to data of core fields like first_name, last_name, email, address... If you want to get data from certain none core fields, you can use the following code:
$data = EventbookingHelperRegistration::getRegistrantData($row);
echo $data['name_of_field']; // Will return value for a custom field with name = **name_of_field**
This event is triggered when status of the registration record changed from Pending to Paid (after payment is completed or admin change status of registration record from Pending to Paid in case registrant using offline payment method for the registration)
public function onAfterPaymentSuccess($row)
{
}
This event is triggered on frontend event detail page. You can write a plugin to handle this event to display more information of the event on event details page if needed. Look at jcomments plugin in the package to see how this event can be used.
public function onEventDisplay($row)
{
}
$row is an object stores information of event being displayed. From this object, you can access to any event information such as ID, Title, Event Date, Event End Date....
$row->id : ID of event
$row->title: Title of the event
$row->main_category_id: ID of main category of event
$row->event_date : Event Date
$row->event_end_date: Event End Date
$row->location_id: ID of the location of event.
This event is triggered on add/edit custom field form. It usually used to allows you to display a form to allow admin control the necessary settings for your custom field.
public function onEditField($row)
{
}
This event is triggered after the custom field is saved to database. It is usually used to save the settings data which you display on custom field add/edit screen so that you can used that settings data later
public function onAfterSaveField($row, $data, $isNew)
{
}
Sometime, you might want to use Events Booking code from outside the component, for example, from module or plugin. For that, the first thing you need to do is add this line of code to make sure all classes in Events Booking is autoload-able:
// Require library + register autoloader
require_once JPATH_ADMINISTRATOR . '/components/com_eventbooking/libraries/rad/bootstrap.php';
// Register the class with Joomla auto loader
JLoader::register('EventbookingModelUpcomingevents', JPATH_ROOT . '/components/com_eventbooking/model/components/com_eventbooking/model/upcomingevents.php');
/* @var EventbookingModelUpcomingevents $model */
$model = RADModel::getTempInstance('Upcomingevents', 'EventbookingModel', ['table_prefix' => '#__eb_']);
$model->setState('id', 1);
$rows = $model->getData();
$data = EventbookingHelperRegistration::getRegistrantData($row);
echo $data['first_name'];
echo $data['last_name'];
echo $data['name_of_field'];
$config = EventbookingHelper::getConfig(); // Return $config object which allows accessing to any config variables
$message = EventbookingHelper::getMessages(); // Return $message object which allows accessing to any message items.