debug: Add permission check logging
Added logging to check_admin_permission to see: 1. Does user have manage_woocommerce capability? 2. Does user have manage_options capability? 3. Is permission ALLOWED or DENIED? If permission is DENIED, WordPress won't call our handler. This would explain why route registers SUCCESS but handler not called.
This commit is contained in:
@@ -35,6 +35,14 @@ class Permissions {
|
||||
* Used for analytics and admin-only endpoints
|
||||
*/
|
||||
public static function check_admin_permission(): bool {
|
||||
return current_user_can('manage_woocommerce') || current_user_can('manage_options');
|
||||
$has_wc = current_user_can('manage_woocommerce');
|
||||
$has_opts = current_user_can('manage_options');
|
||||
$result = $has_wc || $has_opts;
|
||||
error_log(sprintf('WooNooW Permissions: check_admin_permission() - WC:%s Options:%s Result:%s',
|
||||
$has_wc ? 'YES' : 'NO',
|
||||
$has_opts ? 'YES' : 'NO',
|
||||
$result ? 'ALLOWED' : 'DENIED'
|
||||
));
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user