LLMS_Template_Loader::restricted_by_membership( array $info )
Handle content restricted to a membership
Description Description
Parses and obeys Membership "Restriction Behavior" settings
Parameters Parameters
- $info
-
(array) (Required) array of restriction results from llms_page_restricted()
Return Return
(void)
Source Source
File: includes/class.llms.template.loader.php
public function restricted_by_membership( $info ) { $membership_id = $info['restriction_id']; // do nothing if we don't have a membership id if ( ! empty( $membership_id ) && is_numeric( $membership_id ) ) { // instantiate the membership $membership = new LLMS_Membership( $membership_id ); $msg = ''; $redirect = ''; // get the redirect based on the redirect type (if set) switch ( $membership->get( 'restriction_redirect_type' ) ) { case 'custom': $redirect = $membership->get( 'redirect_custom_url' ); break; case 'membership': $redirect = get_permalink( $membership->get( 'id' ) ); break; case 'page': $redirect = get_permalink( $membership->get( 'redirect_page_id' ) ); break; } if ( 'yes' === $membership->get( 'restriction_add_notice' ) ) { $msg = $membership->get( 'restriction_notice' ); } // handle the restriction action & allow developers to filter the results $this->handle_restriction( apply_filters( 'llms_restricted_by_membership_message', $msg, $info ), apply_filters( 'llms_restricted_by_membership_redirect', $redirect, $info ) ); } // End if(). }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |