Skip to content

Instantly share code, notes, and snippets.

@mrhead
Last active June 21, 2018 11:55
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 mrhead/e4a3e8d0c8fcd95bde675add80971013 to your computer and use it in GitHub Desktop.
Save mrhead/e4a3e8d0c8fcd95bde675add80971013 to your computer and use it in GitHub Desktop.
Memberful WP + WP Ultimate Recipe
<?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