WordPress.org

Ready to get started?Download WordPress

Forums

Antispam Bee
[resolved] obsolete code detected (5 posts)

  1. DJIO
    Member
    Posted 1 year ago #

    Hi there!

    I was running Debug Bar to detect an error on my theme but I came across this warning on Deprecated Calls tab.

    I ran a sitewide search and found your plugin using levels intead of capabilities, so
    antispam_bee.php line 670 is:

    if ( !current_user_can('level_2') or !self::get_option('dashboard_chart') ) {

    but it should be:

    if ( !current_user_can('publish_posts') or !self::get_option('dashboard_chart') ) {

    Please change that for the next version
    ;-)

    Best regards,
    Cheers from Brazil

    Djio

    http://wordpress.org/extend/plugins/antispam-bee/

  2. Sergej Müller
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks for detecting ;)

    if ( !current_user_can('author') or !self::get_option('dashboard_chart') ) {

    is better. Agree?

  3. DJIO
    Member
    Posted 1 year ago #

    Hi Sergej,

    Actually author is not a capability, but a role, as stated in this Codex link.
    http://codex.wordpress.org/Roles_and_Capabilities#Author

    The Codex also stands the function current_user_can() expects a capability.
    http://codex.wordpress.org/Function_Reference/current_user_can

    Unless you use an alternative approach, like in this link below.
    http://docs.appthemes.com/tutorials/wordpress-check-user-role-function/

    Hope it helps to clarify.
    =)

  4. Sergej Müller
    Member
    Plugin Author

    Posted 1 year ago #

  5. DJIO
    Member
    Posted 1 year ago #

    You're welcome!
    Anytime.

    I thank you for developing this awesome plugin.
    Soon I expect to finish the translation to pt_BR and post in my list.
    http://www.djio.com.br/traducoes/

    Best Regards,
    Djio

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic