Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greathmaster/12da73c2eab56ebb555dfd9532bf0a47 to your computer and use it in GitHub Desktop.
Save greathmaster/12da73c2eab56ebb555dfd9532bf0a47 to your computer and use it in GitHub Desktop.
Change when Paid Memberships Pro starts and stops PHP sessions.
<?php
/**
* Change when Paid Memberships Pro starts and stops PHP sessions.
* Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_change_pmpro_sessions_start_and_stop() {
// make sure PMPro has loaded
if( !function_exists( 'pmpro_start_session' ) ) {
return;
}
// start sessions ASAP
remove_action( 'pmpro_checkout_preheader', 'pmpro_start_session', -1 );
pmpro_start_session();
// removing this will cause PHP to close the session when all scripts end
remove_action( 'pmpro_after_checkout', 'pmpro_close_session', 32768 );
}
add_action('plugins_loaded', 'my_change_pmpro_sessions_start_and_stop');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment