Home › Forums › Ticket Products › Event Tickets Plus › Hook to get attendee information to 3rd party API
- This topic has 5 replies, 4 voices, and was last updated 9 years, 8 months ago by
Jeffery.
-
AuthorPosts
-
July 27, 2016 at 12:34 pm #1144831
Jeffery
ParticipantHello!
I am looking for a hook or something in the code to help me accomplish this but I was hoping some one here can point me in the right direction. Basically when some one submits a RSVP or Order I want to hook into that submit process and post their information to our CRM. It will help with our marketing flow.
I am looking for any do_action that I can hook on to but haven’t found what I am looking for yet.
Can you please help me with this? Thank you so so much.
-
This topic was modified 9 years, 9 months ago by
Jeffery.
July 27, 2016 at 3:03 pm #1144871Jeffery
ParticipantI did find a hook: add_action(‘event_tickets_rsvp_attendee_created’, ‘alert_andy’, 1);
I think these are supposed to be passing through but I keep getting NULL for them.
$attendee_id, $event_id, $order_id, $attendee
What am I doing wrong?
Thanks.
July 27, 2016 at 4:11 pm #1144905George
ParticipantHey Jeffrey,
Thanks for reaching out. I should mention nice and early here that we are unfortunately not able to help with custom coding or providing code-level assistance on projects.
Not trying to be buzz kill, just want to set your expectations early on!
I’m still happy to point you in the right direction, of course. For example, while the event_tickets_rsvp_attendee_created action is a good one, there is another action that runs right after it that I think might work a bit better:
event_tickets_rsvp_ticket_createdThis allows for four arguments in its callback function: $attendee_id, $event_id, $product_id, and $order_attendee_id.
So, you would do something like this:
add_action( 'event_tickets_rsvp_ticket_created', 'example_callback', 10, 4 );function example_callback( $attendee_id, $event_id, $product_id, $order_attendee_id ) {
// do stuff ...
}
July 27, 2016 at 4:18 pm #1144908George
ParticipantOops, I posted my reply accidentally a bit early. There are two more things worth noting:
1. If you want to have a similar hook for tickets in WooCommerce—i.e., a premium ticket, not a free RSVP—then you can use a similar hook called event_tickets_woocommerce_ticket_created. It has all of the same four parameters as the above-mentioned RSVP hook.
2. I think part of the problem you were facing was in your add_action call itself. You wrote this:
add_action(‘event_tickets_rsvp_attendee_created’, ‘alert_andy’, 1);What this is doing is attaching the “alert_handy” callback function to that hook, with a priority of 1. There is no fourth parameter, which is where you tell the callback function how many arguments should be passed.
If no fourth parameter is added in an add_action call, then the callback assumes only one allowed argument.
So, for example, let’s take your code above. That means that a callback function like this would work:
add_action(‘event_tickets_rsvp_attendee_created’, ‘alert_andy’, 1);function alert_andy( $arg_1 ) {
// do stuff...
}
But if you tried adding more arguments to the callback like in the following example, you would NOT be able to use $arg_2 or $arg_3:
add_action(‘event_tickets_rsvp_attendee_created’, ‘alert_andy’, 1);function alert_andy( $arg_1, $arg_2, $arg_3 ) {
// do stuff...
}
You need to tell the add_action() call that there are 3 arguments instead of the assumed 1. So you would change this:
add_action(‘event_tickets_rsvp_attendee_created’, ‘alert_andy’, 1);to this:
add_action(‘event_tickets_rsvp_attendee_created’, ‘alert_andy’, 1, 3 );I hope this helps. 😀
— George
August 18, 2016 at 9:35 am #1153194Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
This topic was modified 9 years, 9 months ago by
-
AuthorPosts
- The topic ‘Hook to get attendee information to 3rd party API’ is closed to new replies.
