| 2 | | {{{ |
| 3 | | add_filter('map_meta_cap', function(){return array();}, 1,0 ); //<-backdor virus or any plugin |
| 4 | | var_dump( user_can( $admin_user_id = 1, 'unavailable cap' ) ); //return true |
| 5 | | var_dump( user_can( $Subscriber_user_id = 3, 'remove_users' ) ); //return true |
| 6 | | |
| 7 | | //The alternative I propose: |
| 8 | | // insert if(!in_array($cap,$caps)) return false; inside WP_User::has_cap( $cap ) after 'map_meta_cap' filter |
| 9 | | // OR |
| 10 | | // inside if(empty((array)$caps)) return false; inside WP_User::has_cap( $cap ) before the foreach |
| | 7 | The alternative I propose: |
| | 8 | insert `if(!in_array($cap,$caps)) return false;` inside `WP_User::has_cap( $cap )` after 'map_meta_cap' filter |
| | 9 | OR |
| | 10 | insert `if(empty((array)$caps)) return false;` inside `WP_User::has_cap( $cap )` before the foreach |