Skip to content

Instantly share code, notes, and snippets.

@MaryOJob
Created August 13, 2020 19:24
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 MaryOJob/bbec79fd13dd1a0541c949bab5dafa98 to your computer and use it in GitHub Desktop.
Save MaryOJob/bbec79fd13dd1a0541c949bab5dafa98 to your computer and use it in GitHub Desktop.
Disable Level Deselection when using PMPro MMPU
<?php
/**
* MMPU - Prevent user from de-selecting a level if they have previously checked out for level.
*/
function pmpro_output_level_jquery_mmpu_disable() {
if ( wp_script_is( 'jquery', 'done' ) && is_page( 'membership-levels' ) ) {
?>
<script>
jQuery( '.pmpro_level-select-current input' ).prop( 'disabled', 'disabled' );
</script>
<?php
}
}
add_action( 'wp_footer', 'pmpro_output_level_jquery_mmpu_disable' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment