Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
LLMS_Admin_Reporting::get_tab_cap( string $tab = null )
Get the WP capability required to access a reporting tab.
Description Description
Defaults to ‘view_lifterlms_reports’. Most reports implement additional permissions within the view.
Sales & Enrollments tab requires ‘view_others_lifterlms_reports’ b/c they don’t add any additional filters within the view.
Parameters Parameters
- $tab
-
(string) (Optional) ID/slug of the tab.
Default value: null
Return Return
(string)
Source Source
File: includes/admin/reporting/class.llms.admin.reporting.php
private function get_tab_cap( $tab = null ) {
$tab = is_null( $tab ) ? self::get_current_tab() : $tab;
$cap = 'view_lifterlms_reports';
if ( in_array( $tab, array( 'sales', 'enrollments' ), true ) ) {
$cap = 'view_others_lifterlms_reports';
}
/**
* Filters the WP capability required to access a reporting tab.
*
* @since 3.19.4
* @since 7.3.0 Added the `$tab` parameter.
*
* @param string $cap The required WP capability.
* @param string|null $tab ID/slug of the tab.
*/
return apply_filters( 'lifterlms_reporting_tab_cap', $cap, $tab );
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 7.3.0 | Use in_array() with strict type comparison. |
| 3.19.4 | Introduced. |