Recently I turned WP_DEBUG on:
//wp-config.php define('WP_DEBUG', true);
and noticed that my plugins were throwing notices that read:
Notice: has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead.
After fixing my own, it appeared that most other plugins active were throwing the same notices, so I thought I’d post the fix here.
In my case the issue stemmed from how I’d declared the menu pages. I was using numerical role identifiers (deprecated) and string role identifiers. Neither are correct because the menu and submenu functions take capabilities not roles.
//Wrong, using '8' as a role identifier add_menu_page( 'UtMan', 'UtMan', 8, 'utman', array(&$this, 'mainAdmin'), null, 6); //Changed to a capability, correct add_menu_page( 'UtMan', 'UtMan', 'edit_pages', 'utman', array(&$this, 'mainAdmin'), null, 6); //Wrong, using 'administrator' as a role identifier add_submenu_page('utman', 'UtMan Requests', 'Requests', 'administrator', 'utman-requests', array(&$this, 'requestPage')); //Changed to a capability, correct add_submenu_page('utman', 'UtMan Requests', 'Requests', 'edit_pages', 'utman-requests', array(&$this, 'requestPage'));
More here: