Filter
rpress_dashboard_stats_cap
On this page
Filters the capability required to view RestroPress dashboard statistics.
Checked before registering the WordPress dashboard Sales Summary widget, before loading it via AJAX, and before answering the AJAX requests behind the revenue, order, customer and selected-filter dashboard graphs. The default is view_shop_reports. Users without the returned capability get no widget and a 403 JSON error on the graph endpoints.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$capability | string | The capability name to require. Defaults to 'view_shop_reports'. |
Return value#
string. The capability name to require.
Example#
function my_dashboard_stats_capability( $capability ) {
return 'manage_shop_settings';
}
add_filter( 'rpress_dashboard_stats_cap', 'my_dashboard_stats_capability' );
Source#
Applied in:
includes/admin/class-rp-admin-assets.php(line 525), inRP_Admin_Assets::revenue_graph_filter()includes/admin/class-rp-admin-assets.php(line 903), inRP_Admin_Assets::selected_filter()includes/admin/class-rp-admin-assets.php(line 2155), inRP_Admin_Assets::order_graph_filter()includes/admin/class-rp-admin-assets.php(line 2193), inRP_Admin_Assets::customers_data_filter()includes/admin/dashboard-widgets.php(line 21), inrpress_register_dashboard_widgets()includes/admin/dashboard-widgets.php(line 47), inrpress_load_dashboard_sales_widget()
See also#
Was this page helpful?
