Last active
October 20, 2022 08:43
-
-
Save lelandf/96e25ed64a7ae9bc816a9dc9af7ccc9a to your computer and use it in GitHub Desktop.
[RCP] Example of checking if user has content dripped yet
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 | |
// Requires both RCP & Drip Content active | |
add_action( 'wp_footer', function() { | |
$membership_id = 1; | |
$post_id = 31; | |
$membership = rcp_get_membership( $membership_id ); | |
$can_access = \RCP\Addon\DripContent\Visibility\membership_can_access( true, $membership_id, $post_id, $membership ); | |
if ( true === $can_access ) { | |
echo "Yes, this user can access this post. It has dripped."; | |
} | |
if ( false === $can_access ) { | |
echo "No, this user cannot access this post. It has not dripped yet."; | |
} | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment