Forums

User Avatar
User Avatar with User Role Editor (6 posts)

  1. tpflanz
    Member
    Posted 7 months ago #

    Hi,

    Love the plugin!

    I recently added the User Role Editor plugin to allow my site's Editors to edit user profiles. However, even though I changed the Editor's edit_users capabilities, the User Avatar does not appear at all when viewing a user profile in the backend.

    Any recommendations would be appreciated. Thanks!

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

  2. Vladimir Garagulya
    Member
    Posted 7 months ago #

    Thanks.

    I will check the issue with user-avatar and return with my conclusion this week.

  3. Vladimir Garagulya
    Member
    Posted 7 months ago #

    User Avatar plugin shows user avatar in user profile in 2 cases:
    1) current user is profile owner
    2) user is super admin for this blog.
    if(($profile->ID == $current_user->ID || is_super_admin($current_user->ID))) {
    is_super_admin() function in wp-includes/capabilities.php checks if user is super-admin for network in case of multi-site installation or if user has 'delete_users' capability for single WordPress installation.

    Thus, if you work under multi-site WordPress your editor should be super-admin, or add him 'delete_users' capability for stand-alone WordPress configuration.

  4. tpflanz
    Member
    Posted 7 months ago #

    Vladimir,

    Thanks. Works great.

    Travis

  5. lifelikeneek
    Member
    Posted 2 months ago #

    tpflanz and Vladimir,

    Thanks for this post, it made finding the code I needed to edit extremely easy. I am running a multisite installation that I need non-super admin users to be able to edit users on one specific site. To achieve this I have granted them edit_users capability via the User Role Editor as well as some hackery elsewhere.

    Why doesn't User Avatar allow users with edit_user privileges the ability to change other users avatars? It's easy to code.

    Instead of this in user-avatar.php:
    if(($profile->ID == $current_user->ID || is_super_admin($current_user->ID)))

    I changed it to this:
    if(($profile->ID == $current_user->ID || ! current_user_can(‘edit_user’, $current_user) || is_super_admin($current_user->ID)))

    Now I know this is not recommended because it'll break on the next update but I need the feature. Can either of you think of a better way to do this than granting the users Super Admin rights?

  6. tpflanz
    Member
    Posted 2 months ago #

    lifelikeneek,

    In User Role Editor, you simply need to give the Editor delete_users capability so they can change the avatar for each user.

    Note: This will also allow editors to be able to delete a user, but most likely, that would not be an issue.

Reply

You must log in to post.

About this Plugin

About this Topic