Wordpress: Notice: has_cap was called with an argument that is deprecated since version 2.0!
March 27, 2013
PHP | Troubleshooting | WordPress

I've been experimenting with LDAP and Cosign login plugins for WordPress. Most of them are out of date and are more or less incompatible with WordPress v.3.5. Usually the first error that comes up is

Notice: has_cap was called with an argument that is deprecated since version 2.0!

All this means is that instead of using the numerical role identifier argument in a function that adds a menu or submenu, the required capability should be used instead.


Ads by Google

Posted by ellen at March 27, 2013 12:23 PM


For example, in the Simple LDAP Login plugin, the number 10 in a function that creates a settings submenu:

add_options_page("Simple LDAP Login", "Simple LDAP Login", 10, "simple-ldap-login", "simpleldap_menu");

needed to be replaced with

add_options_page("Simple LDAP Login", "Simple LDAP Login", create_users, "simple-ldap-login", "simpleldap_menu");

within a function that requires administrator or Super Admin privileges to run.

This does mean that you need to figure out what capability the user needs to be allowed to see the menu or submenu in question.
Roles and Capabilities are listed here in the WordPress Codex


 Resources


Ads by Google


Ads by Google

 RSS   |   Contact Me


Ads by Google