WordPress.org

Ready to get started?Download WordPress

Forums

User Photo
Current version causing notices / warnings [fixed] (8 posts)

  1. Teeks
    Member
    Posted 2 years ago #

    I deactivated all plugins to confirm the one causing the following problems was definitely user_photo.

    With debug enabled I get the following notice:

    Notice: load_plugin_textdomain was called with an argument that is deprecated since version 2.7 with no alternative available. in /home/user/public_html/wp-includes/functions.php on line 2714

    With Debug bar enabled, this causes warnings as well:

    WARNING: wp-includes/functions.php:924 - Cannot modify header information - headers already sent by (output started at /home/user/public_html/wp-includes/functions.php:2714)
    WARNING: wp-includes/functions.php:3513 - Cannot modify header information - headers already sent by (output started at /home/user/public_html/wp-includes/functions.php:2714)
    WARNING: wp-admin/admin-header.php:9 - Cannot modify header information - headers already sent by (output started at /home/user/public_html/wp-includes/functions.php:2714)

    The warnings are coming from the "_deprecated_argument" function in WP core - only because debug is enabled, but I think its important.
    I disabled those lines (2709-2715) to test, then I get the raw notices about a second error:

    wp-admin/includes/plugin.php:1008 - Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead.
    wp-admin/menu-header.php:112 - Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead.

    FIRST ERROR FIX

    load_plugin_textdomain is called on line 77 of user-photo.php:

    load_plugin_textdomain('user-photo', PLUGINDIR . '/user-photo/localization');

    The second argument is depreciated, as per following instructions, it should pass false for the second argument and use a third ($plugin_rel_path).
    http://codex.wordpress.org/Function_Reference/load_plugin_textdomain

    Use the following instead:

    load_plugin_textdomain('user-photo', false, dirname( plugin_basename( __FILE__ ) ) . '/localization/');

    SECOND ERROR FIX

    Line 671 of user-photo.php:
    add_options_page('User Photo', 'User Photo', 8, __FILE__, 'userphoto_options_page');

    Uses the depreciated user level 8. I changed it to use the updated capabilities.
    add_options_page('User Photo', 'User Photo', 'add_users', __FILE__, 'userphoto_options_page');

    The 'add_users' capability is only for admins, which is compatible with level 8 permissions.

    http://wordpress.org/extend/plugins/user-photo/

  2. Rutwick Gangurde
    Member
    Posted 2 years ago #

    Hi,
    Thanks for bringing this up and for posting the solution.
    However, this might fail if they update the plugin and don't change this code! Let's hope they pick up your solution and implement it! :D

    - Rutwick

  3. Teeks
    Member
    Posted 2 years ago #

    I updated the github repo after I posted here - there's a pull request waiting :D

  4. Rutwick Gangurde
    Member
    Posted 2 years ago #

    Nice! Can you give me the URL please? I need to fork your code and add a minor change...

  5. Teeks
    Member
    Posted 2 years ago #

    https://github.com/nerd-nite/user-photo
    That's the one I updated but on second thought I don't know if its official.

    https://github.com/westonruter
    This seems to be the guy that wrote user-photo but he doesn't have a repo for it as far as I can tell.

  6. Rutwick Gangurde
    Member
    Posted 2 years ago #

    Cool...
    I found this one too: https://github.com/ajmorris/User-Photo/
    Seems like westonruter is the right one.
    Thanks buddy. I'll post here when I put my changes in.

  7. robertmglynn
    Member
    Posted 1 year ago #

    Teeks, thanks for the fix, saved me much time!

  8. johnlanglois
    Member
    Posted 1 year ago #

    Thank you for the detailed analysis and fix.
    It save me a lot of time.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.