Posted: September 15, 2016 at 8:07 am
|
Hi, I’m trying to use a hook, but for some reason the add_action isn’t fired at all. This is the code I’m using:
add_action('AHEE__EE_Transaction_Processor__manually_update_registration_statuses','espresso_track_successful_sale_manual', 10, 2); I copy pasted the code from a working sample here: https://github.com/ds-festival/event_espresso_4_custom/blob/master/espresso_custom.php I am using the code inside a plugin I’m working on. The plugin registers without errors and is working fine otherwise. When I register at an event using the invoice payment method, the add_action should be executed when the registration is completed. But nothing happens. Can anyone tell me whats wrong? Thanks! |
The do_action is probably firing when it’s supposed to, but it’s in another place. The action hook you’re trying to use is fired when you apply a payment via the admin. Your example code where you tried to echo a string to the screen will result in breaking the ajax response. If you want to test the hook, you can do something like this:
Then you go to Event Espresso > Transactions, click on a transaction, then apply a payment where you also update the payment status and registration status. Then you check the last row of your options table to verify that the option was added via your code. |
|
|
Ok thanks, I will try that for testing. Seems I am using the wrong hook though. I’m writing a plugin to create a sequential invoice number. I want to store the invoice number in the meta data of a custom post which is to be created. I thought the hook I’m using was fired when upon successful registration, but apparently not. Can you tell me which hook I have to use instead? |
I’m not sure which hook you would use in that case. A few possibilities are:
|
|
|
September 28, 2016 at 12:32 am Hi Josh, Testing the action by writing a value to the options table worked great, thanks for the tip. Thanks for the support! |
You are invited to do a pull request. |
|
The support post ‘add_action not fired’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.