As previously announced via banners and our newsletters, support is no longer available through this platform.
For easier navigation, you can still click on "Submit a Ticket" here, choose the appropriate category, and you'll be redirected to the correct support channel for your plugin.
You can still access your previous tickets and browse public tickets, but please note that responding to tickets is no longer possible.
Paid customers: Please log in to your store account for support.
Pre-purchase questions: Use the support widget in the bottom-right corner of our websites:
https://wpamelia.com
https://wpdatatables.com
https://wpreportbuilder.com
Hi,
I've been trying all day and can't get this to work so need some help.
Following the guidance at https://wpamelia.com/wp-hooks-notifications/ I've created a custom hook but it doesn't seem to be able to call any data from $data
function amelia_customerisvip($data) {
$appt_id = $data['appointment_id'];
return 'VIP Status:'.$appt_id;
}
// Add filter to handle dynamic placeholder
add_filter('amelia_dynamic_placeholder_customerisVIP', 'amelia_customerisvip', 10, 1);
Ultimately I want to be able to do manipulate the appointment ID but at this stage I can't get it to pull out any data from $data. I can, by testing with Uncanny Automator's hooks function, that $data returns all of these options but they all seem to be empty:
Ideally, rather than Appointment ID, I'd like the customer ID if that's possible?
What am I doing wrong?
Hello Tom,
It seems like you're on the right track, but the issue may lie in the timing of when the $data is being populated or passed to your custom hook. The placeholder data you’re trying to use may not be available at the time you're trying to access it. Let's walk through a few things you can try:
Make Sure Data Is Available:
The placeholders you’re trying to access, like appointment_id, may not be populated at the moment the hook runs, depending on how and when the notification is triggered. Ensure that the data you're trying to manipulate is available at the point of execution.
Check Hook Context:
Confirm that the hook is triggered in the correct context, where the $data array contains the values you're expecting. It’s possible that the data isn't available when your hook is firing, or it may need to be initialized first.
Customer ID:
If you're looking for the customer ID instead of the appointment ID, you can check the $data array for keys related to the customer. Typically, customer_id should be available. You can try this in your function to see if it's populated correctly:
This will check if the customer_id is in the $data array and output it accordingly.
Using the Right Hook:
Ensure you are using the correct hook for your desired outcome. You are using amelia_dynamic_placeholder_customerisVIP, which might not always pass the expected data. You might need a different hook depending on what you need to do with the data.
If you still cannot access the customer_id or other expected data from $data, you can also try logging the $data array at runtime to see exactly what’s being passed:
This will help you debug the structure of $data and confirm what’s available to you.
Let me know if that helps or if you need further assistance!
Kind Regards,
Uros Jovanovic
[email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps, and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables