Skip to content

Instantly share code, notes, and snippets.

@JarrydLong
Forked from andrewlimaza/pmpro-ipn-redirect.php
Last active May 1, 2023 10:32
Show Gist options
  • Save JarrydLong/5a96584035b8b26812330ca214a82964 to your computer and use it in GitHub Desktop.
Save JarrydLong/5a96584035b8b26812330ca214a82964 to your computer and use it in GitHub Desktop.
Post IPN data to multiple URLs example [Paid Memberships Pro]
<?php
/**
* Forward IPN requests from WooCommerce PayPal Standard to also send to Paid Memberships Pro.
* Please change the URL on line 9 to match that of your Paid Memberships Pro site URL.
* Follow this guide to add this to your site - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_forward_ipn() {
if ( isset( $_REQUEST['callback'] && $_REQUEST['callback'] == 'gravityformspaypal' ) {
$fp = wp_remote_post( 'https://saac-arts.org/wp-admin/admin-ajax.php?action=ipnhandler', $_POST );
}
}
add_action('wp_ajax_nopriv_ipnhandler', 'my_pmpro_forward_ipn', 5);
add_action('wp_ajax_ipnhandler', 'my_pmpro_forward_ipn', 5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment