Reports::removeUserFilterIfStudent( $filters )

Remove user filter is nond admin/mod are viewing reports tab

Description

Source

File: bp-integrations/learndash/buddypress/Reports.php

	public function removeUserFilterIfStudent($filters)
	{
    	if (! $currentGroup = groups_get_current_group()) {
    		return $filters;
    	}

		// admin can always view
		if (learndash_is_admin_user()) {
			return $filters;
		}

		$userId = bp_loggedin_user_id();
		$groupId = $currentGroup->id;

		if (! groups_is_user_admin($userId, $groupId) && ! groups_is_user_mod($userId, $groupId)) {
			unset($filters['user']);
		}

    	return $filters;
	}

Changelog

Changelog
Version Description
BuddyBoss 1.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.