How can I use WordPress hooks for customers in Amelia
Amelia provides several hooks related to customers, allowing you to modify customer data or run custom actions when customers are added, updated, retrieved, or connected to WordPress users. These hooks help you extend Amelia safely without adjusting core plugin files.
Hooks require programming knowledge, and support is limited to general guidance.
Customer added
How do I modify customer data before it is added?
amelia_before_customer_added_filter
Type: filter
Use this filter to modify customer data before it is added.
function example($customer)
{
// change customer data
return $customer;
}
add_filter('amelia_before_customer_added_filter', 'example', 10, 1);
How do I run code before a customer is added?
amelia_before_customer_added
Type: action
Runs before a customer is added.
function example($customer)
{
// do action
}
add_action('amelia_before_customer_added', 'example', 10, 1);
How do I run code after a customer is added?
amelia_after_customer_added
Type: action
Runs after a customer is added.
function example($customer)
{
// do action
}
add_action('amelia_after_customer_added', 'example', 10, 1);
How do I run code after a WordPress user is created for a customer?
amelia_customer_wp_created
Type: action
Runs after a WordPress user is created for a customer.
function example($customer, $container)
{
// do action
}
add_action('amelia_customer_wp_created', 'example', 10, 2);
Customer updated
How do I modify customer data before it is updated?
amelia_before_customer_updated_filter
Type: filter
Use this filter to modify customer data before it is updated.
function example($customer)
{
// change customer data
return $customer;
}
add_filter('amelia_before_customer_updated_filter', 'example', 10, 1);
How do I run code before a customer is updated?
amelia_before_customer_updated
Type: action
Runs before a customer is updated.
function example($customer)
{
// do action
}
add_action('amelia_before_customer_updated', 'example', 10, 1);
How do I run code after a customer is updated?
amelia_after_customer_updated
Type: action
Runs after a customer is updated.
function example($customer)
{
// do action
}
add_action('amelia_after_customer_updated', 'example', 10, 1);
Get customers
How do I modify customers before they are retrieved?
amelia_get_customers_filter
Type: filter
Use this filter to modify customers before they are retrieved for the back end.
function example($customers)
{
return $customers;
}
add_filter('amelia_get_customers_filter', 'example', 10, 1);
How do I run code before customers are retrieved?
amelia_get_customers
Type: action
Runs before customers are retrieved for the back end.
function example($customers)
{
// do action
}
add_action('amelia_get_customers', 'example', 10, 1);
Get customer
How do I modify a customer before it is retrieved?
amelia_get_customer_filter
Type: filter
Use this filter to modify customer data before it is retrieved for the back end.
function example($customer)
{
return $customer;
}
add_filter('amelia_get_customer_filter', 'example', 10, 1);
How do I run code before a customer is retrieved?
amelia_get_customer
Type: action
Runs before a customer is retrieved for the back end.
function example($customer)
{
// do action
}
add_action('amelia_get_customer', 'example', 10, 1);