BpGroupReports::showTabOnView()
Determine who can see the tab
Description
Source
File: bp-integrations/learndash/buddypress/components/BpGroupReports.php
protected function showTabOnView() { if (! $currentGroup = groups_get_current_group()) { return 'noone'; } $generator = bp_ld_sync('buddypress')->sync->generator($currentGroup->id); if (! $generator->hasLdGroup()) { return 'noone'; } if (! learndash_group_enrolled_courses($generator->getLdGroupId())) { return 'noone'; } // admin can always view if (learndash_is_admin_user()) { return true; } foreach (bp_ld_sync('settings')->get('reports.access', []) as $type) { $function = "groups_is_user_{$type}"; if (function_exists($function) && call_user_func_array($function, [bp_loggedin_user_id(), $currentGroup->id])) { return true; } } return 'noone'; }
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.