Filter
rpress_view_customers_role
On this page
Filters the capability required to view customers and the RestroPress dashboard.
Supplies the capability string passed to current_user_can() or add_submenu_page() for the customer screens, customer notes, the customer search AJAX endpoint, the Command Center refresh endpoint and the Dashboard submenu entry. The default is view_shop_reports. Returning a different capability changes who can see those screens and 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_customers_capability( $capability ) {
return 'edit_shop_payments';
}
add_filter( 'rpress_view_customers_role', 'my_customers_capability' );
Notes#
Despite the name, the value also gates the Dashboard submenu page and the Command Center live refresh, so changing it affects those as well. Capability for editing customers is filtered separately by rpress_edit_customers_role.
Source#
Applied in:
includes/admin/admin-pages.php(line 57), inRP_Admin_Menus::admin_menu()includes/admin/customers/customer-actions.php(line 306), inrpress_customer_save_note()includes/admin/customers/customers.php(line 105), inrpress_render_customer_view()includes/admin/dashboard/class-rpress-command-center-dashboard.php(line 352), inRPRESS_Command_Center_Dashboard::ajax_refresh()includes/class-rpress-ajax.php(line 1630), inRP_AJAX::customer_search()
See also#
Was this page helpful?
