Skip to content

Instantly share code, notes, and snippets.

@lelandf
Last active October 20, 2022 08:43
Show Gist options
  • Save lelandf/96e25ed64a7ae9bc816a9dc9af7ccc9a to your computer and use it in GitHub Desktop.
Save lelandf/96e25ed64a7ae9bc816a9dc9af7ccc9a to your computer and use it in GitHub Desktop.
[RCP] Example of checking if user has content dripped yet
<?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