BP_Group_Extension::group_access_protection( bool $user_can_visit, array $no_access_args )

Filter the access check in bp_groups_group_access_protection() for this extension.


Description Description

Note that $no_access_args is passed by reference, as there are some circumstances where the bp_core_no_access() arguments need to be modified before the redirect takes place.


Parameters Parameters

$user_can_visit

(Required) Whether or not the user can visit the tab.

$no_access_args

(Required) Array of args to help determine access.


Top ↑

Return Return

(bool)


Top ↑

Source Source

File: bp-groups/classes/class-bp-group-extension.php

	public function group_access_protection( $user_can_visit, &$no_access_args ) {
		$user_can_visit = $this->user_can_visit();

		if ( ! $user_can_visit && is_user_logged_in() ) {
			$current_group = groups_get_group( $this->group_id );

			$no_access_args['message'] = __( 'You do not have access to this content.', 'buddypress' );
			$no_access_args['root'] = bp_get_group_permalink( $current_group ) . 'home/';
			$no_access_args['redirect'] = false;
		}

		return $user_can_visit;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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