Posted: May 29, 2014 at 10:10 am
|
Hey, I’m looking to add the registrants email address with CampaignMonitor. Is there a hook or function that I can do this with? So when a sucessful registration has been made, I can execute some code. <code>function myFunctionAfterRegistration(){ // CampaignMonitor stuff } add_action( 'myFunctionAfterRegistration', 'ee3_sucessful_registration' );</code> Any help appreciated 🙂 Thanks! |
Hi Andrew, Either action_hook_espresso_track_successful_sale or action_hook_espresso_email_after_payment will work for this job. |
|
|
Hello, I can’t seem to get this hook working – any ideas? function CM_delegate_import($payment_data) { require_once(dirname(__FILE__) .’/csrest_subscribers.php’); $wrap = new CS_REST_Subscribers(‘d4839efe4cece14010247e961fdae905’, ‘a62f907439fb09b96710796738ef3a7a0a5cd2c5b371efa3’); |
Hi Andrew, It looks like the add_action call has the functions in the incorrect order. You want to add your ‘CM_delegate_import’ function to the ‘action_hook_espresso_track_successful_sale’ hook, yet the call is trying to add ‘action_hook_espresso_track_successful_sale’ to your ‘CM_delegate_import’ function. add_action('CM_registration_import', 'action_hook_espresso_track_successful_sale'); Should be add_action('action_hook_espresso_track_successful_sale', 'CM_registration_import'); See here for reference: |
|
|
Hey there, Thank you for your email – a silly error indeed. Am I accessing the data objects within $payment_data correctly? |
|
The issue does appear to be accessing the email address, first name & last name within $payment_data. I manually set my CM $data[‘xx’]; and it imported into CM fine. Can you advise if I am passing $payment_data across OK, and how I can acess the above info easily? Thanks in advance! |
|
Here’s the code that I have: <code> function CM_delegate_import($payment_data) { include_once(DIRNAME(__FILE__).'/csrest_subscribers.php') $wrap = new CS_REST_Subscribers('key1', 'key2'); if(is_array($payment_data)) { foreach($payment_data as $data) { $subscriber = $wrap->add(array( 'EmailAddress' => $data['contact'], 'Name' => $data['fname'] . $data['lname'], 'CustomFields' => array(), 'Resubscribe' => true )); } } } add_action('action_hook_espresso_track_successful_sale', 'CM_delegate_import');</code> |
|
<pre class=”brush: php; gutter: true; first-line: 1; highlight: []; html-script: false”>function CM_delegate_import($payment_data) { include_once(DIRNAME(__FILE__).'/csrest_subscribers.php') $wrap = new CS_REST_Subscribers('key1', 'key2'); |
Are you only wanting to add an attendee to Campaign Monitor if the attendee has successfully paid for a registration or would you like that info as soon as it is available? |
|
|
Hello, For when they have succesfully paid. I’m close, just need a nudge on why I can’t get the data. I have multiple registrants per registration hence the foreach Thank you in advance. |
Have you tried outputting $payment_data? Add var_dump($payment_data); To the top of your function. Depending on the registration you find different results. |
|
|
Hello! I’ve added var_dump but sadly my code isn’t working. What would be the best way to output or collect the var_dumo / array info in $payment_data? I suspect my code isn’t working as $payment_data is not an array, or is empty? |
Hi Andrew, It turns out $payment_data is an array. You can use print_r to print the values of $payment_data onto the Payment overview page like this: add_action('action_hook_espresso_track_successful_sale', 'CM_delegate_import', 10); function CM_delegate_import($payment_data) { print_r($payment_data); } |
|
The support post ‘EE3:Action/Hook for after a payment confirmation and sucessful reg?’ 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.