PHP not seeing PMpro functions (via Code Snippets)
-
Code Snippets doesnt see the PMpro functions at all!
My own code was failing so then I used an example from you guys (larger block below) and further isolated to the code to see that :if( function_exists( 'pmpro_hasMembershipLevel' )… returns false! Its not finding the PMpro functions! Its the strangest thing as this worked with ARmember, but for PMpro it does not.
(I am looking to move over to PMpro and simply want to convert a snippet I have to work with PMpro based on membership level. that failed so then i tried this sample from github which also failed )function premium42_class( $classes ) {
global $current_user;
if( function_exists( 'pmpro_hasMembershipLevel' ) && pmpro_hasMembershipLevel() ) {
$classes[] = 'pmpro-body-has-level-' . $current_user->membership_level->ID;
}
return $classes;
}
add_filter( 'body_class', 'premium42_class');
The topic ‘PHP not seeing PMpro functions (via Code Snippets)’ is closed to new replies.