Created
          October 22, 2020 12:25 
        
      - 
      
- 
        Save andrewlimaza/2e8f148b3c40d63274c544b3087a5c83 to your computer and use it in GitHub Desktop. 
    Post IPN data to multiple URLs example [Paid Memberships Pro]
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?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['wc-api'] && $_REQUEST['wc-api'] == 'WC_Gateway_Paypal' ) { | |
| $fp = wp_remote_post( 'https://website.com/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