Redirecting to dashboard when clicking "Change Avatar" on user profile page

Hi

I’ve setup a multi-site install to allow admins to edit users – however – when clicking on the “Change Avatar” link the admin gets redirected to the main dashboard page.

I am guessing it is because the “Change Avatar” link goes to a link with “network” in it (…/wp-admin/network/settings.php?page=edit-user-avatar&uid=88) which is restricted to super admins.

Any ideas on how to tweak the plugin for this situation?

  • Philip John
    • DEV MAN’s Apprentice

    Hiya Jason!

    Firstly, I’m guessing this is probably something to do with the permissions change you’ve implemented.

    So… can you confirm whether undoing the changes you made causes Avatar to function correctly?

    If that’s the case, please let me know what changes you made and any code that includes. That way, we can see where it might be interfering with Avatar and see about offering a solution.

    Cheers!

    Phil

  • Jason
    • Flash Drive

    Hey Phil – avatars isn’t functioning incorrectly – it just isn’t built to allow admins to change the avatars for users.

    The theme function (thanks to Brent) I have added is:

    function mc_admin_users_caps( $caps, $cap, $user_id, $args ){

    foreach( $caps as $key => $capability ){

    if( $capability != 'do_not_allow' )
    continue;

    switch( $cap ) {
    case 'edit_user':
    case 'edit_users':
    $caps[$key] = 'edit_users';
    break;
    case 'delete_user':
    case 'delete_users':
    $caps[$key] = 'delete_users';
    break;
    case 'create_users':
    $caps[$key] = $cap;
    break;
    }
    }

    return $caps;
    }
    add_filter( 'map_meta_cap', 'mc_admin_users_caps', 10, 4 );

    It just allows admins to edit user profiles (except for avatars at this stage).

  • Philip John
    • DEV MAN’s Apprentice

    Thanks for the code Jason.

    I’ve looked at that and tried to identify where it might be interfering with Avatars. I can’t see it though, so I’m going to ask the developer to jump in here.

    It also strikes me that your custom code could possibly be tweaked to allow admins to edit user avatars.

    That’s developer territory though, so I’ll ping them to have a look at a solution and post here.

    Phil

  • jabbermonkey
    • Flash Drive

    I’m having the same problem. Asked this very same question over three weeks ago, no resolution. Took down my site, reinstalled fresh EVERYTHING. Added a test user (NO BLOG SITE), and a user can NOT change his avatar.

    I assign a test user (NON-BLOG USER), known in WP as a SUBSCRIBER.

    Said SUBSCRIBER logs in at main login (front page of Edu-Clean) and is given Admin Bar with:

    Edit My Profile

    Dashboard

    Logout

    SUBSCRIBER can click user Admin Bar to “Edit My Profile” and is taken to:

    http://xxx.xxxxxx.xxx/xxx/wp-admin/user/profile.php FOR ABOUT 5 SECONDS, then to

    http://xxx.xxxxxx.xxx/xxx/wp-admin/user/?c=1 WHERE THERE IS A USELESS BLANK PAGE with a PROFILE ICON (at top right)…click on icon and it goes to:

    http://xxx.xxxxx.xxx/xxx/wp-admin/?frame=profile WHICH IS ALSO A BLANK PAGE.

    All other Admin Bar options bring user either back to main page or to blank profile page (which then redirects to above).

    I do have “Easy” everything installed and activated.

    Deactivated Easy Wizard, no effect on issue.

    Deactivated Easy Blogging, User Profile page works….BUT still can NOT change SUBSCRIBER Avatar…it just redirects back to the SUBSCRIBER DASHBOARD.

    So, DEVS, it’s a problem with the EASY BLOGGING toy.

    What’s the fix?

    Everything is STOCK INSTALL:

    I use WPMU 3.1

    Edu-Clean with no modifications

    Only WPMU DEV plugins

    Is this is because of the permission that YOU have given it at the wp-admin page? Why don’t you check that out. Like after the SUBSCRIBER logs in, is the script running at that time – well the answer is yes and it should be no.

  • Aaron
    • Ex Staff

    @Jason, the plugin is only designed to allow super admins to edit user avatars. You will have to do a custom modification of the plugin to meet your needs, which is beyond what we can do for you.

    @jabber, It definitely sounds like an issue with the easy blogging plugin, not necessarily Avatars. You can confirm it works with easy blogging uninstalled?

  • antKat
    • HummingBird

    Hi, I didn’t know whether to start a new thread here but I have the same issue and also your team needs to know that some of your members spend a lot of time researching through old forums before submitting questions.

    After spending a lot of time trying to figure out what plugin may be impacting the upload of avatars, since it originally worked when I, the super-admin tested it. Now I have user’s and it did not work. Then, I came across this thread. In Aaron’s last response here, am I to understand that on a multisite, the owner of the sub-site must submit the avatar to the super-admin in order to upload it? I see that this is indeed happening – but what is the logic in this? On every other profile item, the user themselves enters their own data. What is special about avatars that it requires the super-admin intervention?

    Is there a work-around for this issue in the plugin itself? If so, please provide instruction. If there isn’t one,

    I do have the “User Role Capability” plugin, could this provide a solution? I don’t see where I can change the capability here – but if there is, please provide instruction.

    Our site “owners” have role of Editor.

  • antKat
    • HummingBird

    Correct, as a super-admin I can upload avatars on any of the sites; however, the users, who are editors, cannot upload. Once the image is selected and you click upload, instead of saving it redirects to the admin page. From the thread above, it sounds like this is by design? So, please tell me, should the editors be able to upload their own avitars? Or how can I set them up with permission to upload an avitar ?

  • Vladislav
    • Dead Eye Dev

    Hi,

    Is the problem that users can’t create and edit *their own* avatars? This would manifest in a scenario like this: I am an user on your site, and I’m unable to go to *my* profile page and change *my* avatar. Is this what’s happening? If so, this could be a bug.

    If the problem is that your *site owners* can’t change avatars of *other* users (this was the case in the opening post), that is a whole different matter. In WP3.1+ multisite environment, the user details can’t be changed by other users, except by Super Admins. This is by design, as users can be a part of multiple sites, so it makes sense to only allow this to Super Admins (guys that administer the whole network).

    This behavior can be overridden for WP alone, as Jason already posted, but it’s not supported within the plugin itself as it’s a pretty specific behavior. Furthermore, while the support for this override can be added in the plugin for regular Site Admins, it would do no good in your particular scenario. The reason for this is that your site owners are Editors – which means that the plugin, is order to support your use case, should support changing avatars by just about any random role, which is not a very good idea at all.

  • antKat
    • HummingBird

    Hi,

    Clarified, the problem I experienced yesterday was that user’s could not upload their own avatars; but the superadmin could upload/edit/save the user’s avatar.

    Today, as I test it, neither can complete an upload/save; for the user, when you click on upload or alternative upload, it redirects back to the dashboard. However, with the superadmin, I am able to upload the image, but I am getting errors with crop.

    If “upload” was used for upload, the error message is:Fatal error: Call to undefined function ImageCreateFromjpeg() in /home/sportsli/public_html/wp-content/plugins/avatars/avatars.php on line 783

    If “alternative upload” was used for upload, the error message is: Fatal error: Call to undefined function ImageCreateFromjpeg() in /home/sportsli/public_html/wp-content/plugins/avatars/avatars.php on line 751

  • Vladislav
    • Dead Eye Dev

    Have you changed hosts in the meanwhile, or did your host changed something in their configuration? Those functions are a part of GD library, which is a PHP module. The errors you’re receiving indicate that the module isn’t loaded. The plugin needs GD library support in order to manipulate the images.

  • antKat
    • HummingBird

    Well the GD was part of the issue. Now I am back able to upload avatars for users – but they can not do it for themselves. When logged in as a user, clicking on the upload/alternative upload redirects back to dashboard.

    I submitted a support ticket at VPS.net regarding the issue. Now that I am still having a problem, I asked them to check again. They said that it must be a setting in WordPress. Any thoughts?

    @Phil, were there any other configuration/files issues you encountered with the migration to VPS.net.

    I just got INVITES working again. Trying to avoid any more surprises.

  • antKat
    • HummingBird

    As I mentioned earlier in the thread, our multisite “owners” come in with the role of Editor. This allowed us to simplify the back-end dashboard significantly. The editor could not upload their own avatar. Although I thought that all registered users from Subscriber’s up could have avatars.