Skip to content

Instantly share code, notes, and snippets.

@dparker1005
Last active March 14, 2022 18:26
Show Gist options
  • Select an option

  • Save dparker1005/84159bb9d2a6c13b7443bfa161f1c23e to your computer and use it in GitHub Desktop.

Select an option

Save dparker1005/84159bb9d2a6c13b7443bfa161f1c23e to your computer and use it in GitHub Desktop.
Make sure that the MemberInvoice class is loaded when using MMPU.
<?php
// Copy from below here...
/**
* Make sure that the MemberInvoice class is loaded when using MMPU.
*
* 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/
*/
function my_pmpro_ensure_MemberInvoice_loaded() {
if ( ! class_exists( 'MemberInvoice' ) && defined( 'PMPROMMPU_DIR' ) && file_exists( PMPROMMPU_DIR . '/includes/invoice.php' ) ) {
require PMPROMMPU_DIR . '/includes/invoice.php';
}
}
add_action( 'init', 'my_pmpro_ensure_MemberInvoice_loaded' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment