Support

Home Forums Event Espresso Premium Need help with the usage of an action hook

Need help with the usage of an action hook

Posted: July 28, 2021 at 3:26 pm

Viewing 4 reply threads


SCCDS

July 28, 2021 at 3:26 pm

Hello apologies if this is a duplicate, I tried posting just a moment ago and it didn’t seem to confirm that it was posted and its not showing in my recent posts so I’ll try again. So basically I am trying to figure out the usage of an action hook “AHEE__EE_Checkin__construct” which I was able to at least trigger successfully by sending a test email. But I am stuck on the use of parameters to retrieve data such as registration date or ticket data. Just looking for a push in the right direction, and so far trying to output a single parameter hasn’t given me useful information just yet. I will keep playing with it but some help is appreciated. Thank you

Brian


SCCDS

July 28, 2021 at 3:28 pm

And just as some background information, I’m basically trying to trigger an action on check in of an event, which then gets the necessary information, registration information more specifically to then get ticket data and then finally learndash data sine we have the connect plugin installed. Of course I don’t expect help with the learndash part, just need to have it getting some data


Tony

  • Support Staff

July 28, 2021 at 4:36 pm

Hi there,

May I recommend a different hook?

do_action("AHEE__EE_Registration__toggle_checkin_status__{$checked_status}", $this, $DTT_ID);

{$checked_status} will be either checked_in or checked_out

As the hook name suggests, that’s fired when the check-in status is toggled so hooking into AHEE__EE_Registration__toggle_checkin_status__checked_in will allow you to fire a function when the registration status is toggled to checked in.

In the above $this is going to be the current EE_Registration object so you can pull whatever details you need.

Does that help?

Whilst we can’t write out your custom code for you (I know you aren’t asking us to) I’m more than happy to help point you in the right direction when using our model system to get the data you need.


SCCDS

July 29, 2021 at 2:39 pm

Thanks for the help Tony, it was very helpful, this action hook definitely worked way better, I was able to get the implementation working pretty much right away by using the first argument, and then checking for a list of functions that it contained, and like this I was able to get a ticket id, registration id, and attendee data to do what I needed. For some reason the other hook got triggered multiple times at once but this solution proved to be much more stable


Tony

  • Support Staff

July 30, 2021 at 6:55 am

Yeah, the reason that other hook is triggered multiple times is it is fired every time a class is instantiated and it’s expected that you would have multiple instances of that class as you’ll have a new instance for every check-in row.

Anyway, I’m glad that hook worked for you 🙂

Any further questions just let us know.

Viewing 4 reply threads

The support post ‘Need help with the usage of an action hook’ 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.

Event Espresso