| @@ -33,9 +33,10 @@ | ||
| 33 | 33 | * @param string $capability The required capability, defaults to manage_options |
| 34 | 34 | * @return bool|WP_Error True if has capability, WP_Error otherwise |
| 35 | 35 | */ |
| 36 | 36 | protected function checkCapability($capability = 'manage_options') { |
| 37 | - if (!current_user_can($capability)) { | |
| 37 | + $allowed = function_exists('easy_invoice_user_can') ? easy_invoice_user_can($capability) : current_user_can($capability); | |
| 38 | + if (!$allowed) { | |
| 38 | 39 | return new \WP_Error('invalid_capability', __('You do not have permission to perform this action.', 'easy-invoice')); |
| 39 | 40 | } |
| 40 | 41 | |
| 41 | 42 | return true; |