vae_register_hook()
Use the vae_register_hook()
function to register code that will run
when certain Vae events are triggered. For VaeML tag-based events, your
function can halt the default Vae processing by returning false
.
Usage
vae_register_hook($event, $callback_function)
-
$event
- Name of the event you wish to hook into. A list of available hooks can be found below. -
$callback_function
- name of a PHP function you have defined that will be called when your event occurs. For VaeML tag-based events, returntrue
to continue processing as normal, orfalse
to halt normal processing.
Returns
Returns true
.
Available Events
Any VaeML tag that submits data back to the server, such as
<v:formmail>
, <v:store:add_to_cart>
, and <v:store:checkout>
may be
specified as a hook. Your code will run before the default code runs.
Specify just the tag name, such as formmail
or store:checkout
Other available events are:
-
content:created
- fires when an entry of content is created. ID of the new entry is passed in as a parameter. -
content:destroyed
- fires when an entry of content is deleted. ID of the old entry is passed in as a parameter. -
content:published
- fires when an entry of content is published. ID of the entry is passed in as a parameter. -
content:unpublished
- fires when an entry of content is unpublished. ID of the entry is passed in as a parameter. -
content:updated
- fires when an entry of content is updated. ID of the updated entry is passed in as a parameter. -
customer:created
- fires when a Customer is created. ID of the new customer is passed in as a parameter. -
customer:destroyed
- fires when a Customer is deleted. ID of the old customer is passed in as a parameter. -
customer:updated
- fires when a Customer is updated. ID of the updated customer is passed in as a parameter. -
store:cart:updated
- fires after an item is added to the cart or the cart is updated. -
store:checkout:success
- fires after checkout completes and payment has been processed.
Sample Usage
In your __vae.php file:
In your __vae.php file: