WordPress.org

Ready to get started?Download WordPress

Forums

Cache Images
"has_cap was called with an argument that is deprecated" (1 post)

  1. knew
    Member
    Posted 2 years ago #

    Hi,

    I'd been getting PHP 'notices' to the effect of:

    "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. in /Users/***/wordpress/wp-includes/functions.php on line 3466"

    This message was frustrating as it seemed to interfering with modification of the headers.

    ie. After pressing 'save' on the 'Edit User' page, I was presented with the previous notice, plus the following warning:

    Warning: Cannot modify header information - headers already sent by (output started at /Users/***/wordpress/wp-includes/functions.php:3466) in /Users/***/wordpress/wp-includes/pluggable.php on line 934

    And the rest of the page content was not displayed.

    So after a bit of searching I found that in cache-images.php, line 86, the function call 'add_management_page' contained the argument that is deprecated.

    I changed it from:

    add_management_page( __( 'Cache Remote Images', 'cache-images' ), __( 'Cache Remote Images', 'cache-images' ), 8, __FILE__, 'mm_ci_manage_page' );

    to

    add_management_page( __( 'Cache Remote Images', 'cache-images' ), __( 'Cache Remote Images', 'cache-images' ), 'activate_plugins', __FILE__, 'mm_ci_manage_page' );

    Now the notice is gone, and the headers are not modified.

    The question is; is this the correct fix?
    Also, is the capability level of 'activate_plugins' a suitable one?

    Thanks,
    Anton

    http://wordpress.org/extend/plugins/cache-images/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic