Last active
June 21, 2018 11:55
-
-
Save mrhead/e4a3e8d0c8fcd95bde675add80971013 to your computer and use it in GitHub Desktop.
Memberful WP + WP Ultimate Recipe
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 | |
$wp_ultimate_recipe_activated = in_array( 'wp-ultimate-recipe/wp-ultimate-recipe.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ); | |
$memberful_wp_activated = in_array( 'memberful-wp/memberful-wp.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ); | |
if ( $wp_ultimate_recipe_activated && $memberful_wp_activated ) { | |
add_action( 'wp', 'disable_wp_ultimate_recipe_content_filter' ); | |
function disable_wp_ultimate_recipe_content_filter() { | |
global $post; | |
if ( ! memberful_can_user_access_post( wp_get_current_user()->ID, $post->ID ) ) { | |
$wp_ultimate_recipe = WPUltimateRecipe::get(); | |
$recipe_content = $wp_ultimate_recipe->helper( "recipe_content" ); | |
remove_filter( 'the_content', array( $recipe_content, 'content_filter' ), 10 ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment