You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 16 Next »

Hooking into an event in Blesta consists of merely filling in a stubbed callback method, or returning an array from a plugin's getEvents() method. Blesta offers a number of events that are automatically triggered when needed. These events may be found in the /installdir/components/events/ directory.

In some cases, for example when writing a plugin, you may wish to execute a custom event within the scope of your plugin. For instance, if your plugin allows for the creation of invoices, you may wish to execute an event when an invoice is created. For details on custom events see the Creating Events section of this manual.

Events

EventTriggered WhenDefault Event HandlerParametersReturnsSince
Appcontroller.preActionA URI is requestedEventsAppControllerCallback::preAction()voidvoid3.0
Clients.createA client is createdEventsClientsCallback::create()
  • client - An object representing the client that was created.
void3.1
Emails.sendAn email template is sentEventsEmailsCallback::send()
  • action - The action that specifies the email group being sent
  • options - An array of options passed to Emails::send(), which may include:
    • to_client_id - The ID of the client the message was sent to
    • from_staff_id - The ID of the staff member the message was sent from
    • from - The from address override
    • from_name - The from name override
    • reply_to - The reply to address override
  • tags - A key/value pair of replacement tags for the email.

array

Key/value pairs to merge with tags.

3.1
Emails.sendCustomA non-template based email is sentEventsEmailsCallback::sendCustom()
  • options - An array of options passed to Emails::send(), which may include:
    • to_client_id - The ID of the client the message was sent to
    • from_staff_id - The ID of the staff member the message was sent from
    • reply_to - The reply to address override
  • tags - A key/value pair of replacement tags for the email.

array

Key/value pairs to merge with tags.

3.1
Users.loginA user logs inEventsUsersCallback::login()
  • user_id - The ID of the user that successfully logged in
void3.1
Users.logoutA user logs outEventsUsersCallback::logout()
  • user_id - The ID of the user attempting to log out
void3.1
Navigation.getSearchOptionsStaff search options are displayedEventsNavigationCallback::getSearchOptions()
  • options - A key/value pair of search options where each key is the URI to redirect search queries to and the value is the name of the search option. When implemented, the event handler should modify the options parameter using EventObject::setParams().
  • base_uri - The base URI for the currently logged in user.
void3.0
  • No labels