Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PMPro - Paypal Description test
<?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
You can’t perform that action at this time.