Last active
September 11, 2020 18:10
-
-
Save ronalfy/769a74e850b7e1744582a8da723bde46 to your computer and use it in GitHub Desktop.
PMPro - Paypal Description test
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 | |
/** | |
* Returns an empty string for PayPal to make sure special characters are not causing PayPal to fail. | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
/** | |
* Return an empty description for testing with PayPal. | |
* | |
* @param string $profile_description Profile description of the level. | |
* @param object $order PMPro Order Object. | |
* @param string $sitename The name of the site. | |
* | |
* @return string empty string. | |
*/ | |
function pmpro_paypal_description_test( $profile_description, $order, $sitename ) { | |
// Uncomment the error logs below if you'd like to see what is being passed to PayPal and you can check your PHP error logs. | |
// error_log( print_r( $profile_description, true ) ); | |
// error_log( print_r( $order, true ) ); | |
// error_log( $sitename ); | |
// return 'Test Level - Site Name'; // uncomment if empty string does not work please. | |
return __return_empty_string(); | |
} | |
add_filter( 'pmpro_paypal_level_description', 'pmpro_paypal_description_test', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment