Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Last active January 22, 2024 17:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save strangerstudios/0ec01d2a9fc0b0f33896 to your computer and use it in GitHub Desktop.
Save strangerstudios/0ec01d2a9fc0b0f33896 to your computer and use it in GitHub Desktop.
Tests to check if you are on certain PMPro pages.
<?php
global $pmpro_pages, $pmpro_level;
if(is_page($pmpro_pages['levels'])) {
//on the pricing/levels page
}
if(is_page($pmpro_pages['checkout'])) {
//on the checkout page
}
if(is_page($pmpro_pages['checkout']) && $pmpro_level->id == $level_id) {
//on a specific levels' checkout page
}
/*
When a checkout is processed, the pmpro_after_checkout hook is fired.
The only parameter is $user_id.
You can get the $level_id through global $pmpro_level->id or $_REQUEST['level']
*/
if(is_page($pmpro_pages['confirmation'])) {
//on the confirmation page
}
if(is_page($pmpro_pages['confirmation']) && !empty($_REQUEST['level']) && $_REQUEST['level'] == $level_id) {
//on the confirmation page for a specific level
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment