Created
May 10, 2018 14:36
-
-
Save ideadude/d759bfacf1fd6c3c084dbba4fc65ae81 to your computer and use it in GitHub Desktop.
Change when Paid Memberships Pro starts and stops PHP sessions.
This file contains 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 | |
/** | |
* 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