@chinjohn, The plugin overrides the default IPN URL so it can process the order. You can use the action hook that it triggers after processing the order. For example:
function my_callback_function($ipn_response) {
// do stuff
}
add_action('wp_paypal_ipn_processed', 'my_callback_function');
Ok Thank You for your response. I already tried something else and it worked fine.
I edited your ipn file(between line 149 and 150) like this:
wp_paypal_debug_log("Order information updated", true);
// do stuff
do_action('wp_paypal_order_processed', $post_id);
It worked and the debug log still reached the last line “IPN processing completed”. Hope its still cool I did it like that right?
Thank You.
@chinjohn, This should work but the code will get overriden every time you update the plugin. It’s better to have a separate file where you listen to the hook and run additional tasks (as shown in my example).
Ok. Thank You I’ll see how I can handle this.
I am trying to call a function using your example but it isn’t working.
I have the following line in paypal-ipn.php (line 142) :
add_action(‘wp_paypal_ipn_processed’, ‘my_callback’);
Then in a separate file I have this (for testing)
function my_callback() {
$now=date(“Y-m-d H:i:s”);
$fp = fopen(‘feedback.txt’, ‘a’);
fwrite($fp, ‘Function triggered.’);
fwrite($fp, “\n”);
fwrite($fp, “$now”);
fwrite($fp, “\n”);
fclose($fp);
}
—————
I have a include line at the top of paypal-ipn.php for the file I created.
No Luck – any ideas would be appreciated.
Update:
I think I got it. I have created a plugin with the code and it seems to be working. This way my code should be untouched when the wp-paypal plugin is updated.