LLMS_Integration_Buddypress::restriction_checks( array $results )

Allows restricting of BP Directory Pages for Activity and Members via LifterLMS membership restrictions


Description Description


Parameters Parameters

$results

(array) (Required) array of restriction results


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/integrations/class.llms.integration.buddypress.php

	public function restriction_checks( $results ) {

		// only check directories
		if ( ! bp_is_directory() ) {
			return $results;
		}

		$post_id = null;

		// activity
		if ( bp_is_activity_component() ) {

			$post_id = bp_core_get_directory_page_id( 'activity' );

		} elseif ( bp_is_members_component() ) {

			$post_id = bp_core_get_directory_page_id( 'members' );

		} elseif ( bp_is_groups_component() ) {

			$post_id = bp_core_get_directory_page_id( 'groups' );

		}

		if ( $post_id ) {

			$restriction_id = llms_is_post_restricted_by_membership( $post_id, get_current_user_id() );

			if ( $restriction_id ) {

				$results['content_id'] = $post_id;
				$results['restriction_id'] = $restriction_id;
				$results['reason'] = 'membership';

			}
		}

		return $results;

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.12.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.





Permalink: