Customer Has Access Filter

The wpvs_custom_has_access_check filter allows you to customize video restriction and permission.

Add the following to either your themes functions.php file or within your plugin files:

add_action( 'wpvs_custom_has_access_check', 'wpvs_my_custom_has_access_check', 10, 4 );

function wpvs_my_custom_has_access_check($user_id, $membership_array, $user_memberships, $post_id) {
    // YOUR CUSTOM CODE HERE
$return_array = array(
'has_access' => true|false,
'no_access_reason' => $your_reason,
'message' => $message_to_display
); return $return_array; }

Parameters

  • user_id: The current users ID
  • membership_array: All memberships required to access the video (see below for variables)
  • user_memberships: The current users memberships
  • post_id: The current post (video) ID

user_memberships (individual) structure:

The user_memberships parameter is an array of memberships, each one with the following structure:

array(
   'plan'           = (ID of Plan),
   'id'             = (Stripe Subscription ID, PayPal Billing Agreement ID or CoinGate Order ID),
   'amount'         = (Price of Membership),
   'name'           = (Name of Membership),
   'interval'       = (Membership Interval),
   'interval_count' = (Membership Interval Count),
   'ends'           = (timestamp - when the membership ends),
   'status'         = (status_of_subscription),
   'type'           = (stripe, paypal, coingate, stripe_test, paypal_test, coingate_test),
   'coin'           = (ONLY FOR COINGATE MEMBERSHIPS IF BTC OR LTC WAS USED)
);