On multisite it's not working for me

Hi,

I just installed a new wordpress 3.5.1 in multisite mode. The only plugin installed on it is the Avatars.

I registered a new user. This user not a blog owner, can't do anything just to write comments and modify its own data.

When i go to the "Your Avatar" page, select a file and upload it, then the Crop Image page is appeared, but the image on it is broken. The image is on the right place and accessible.
The admin url is:
/wp-admin/user/profile.php?page=user-avatar&action=upload_process
but the file url is:
../wp-content/uploads/avatars/user/c81/image.jpg
because of that, the image url will be:
/wp-admin/wp-content/uploads/avatars/user/c81/image.jpg
The directories rights are ok, because the image is uploaded and I can find it under:
/wp-content/uploads/avatars/user/c81/image.jpg
That is my first problem.

Second, when I clicked on the Crop image button, i was sent to this page:
/wp-admin/profile.php?page=user-avatar&updated=true&updatedmsg=Avatar+updated.
where i get a message:
"You attempted to access the "WP Test" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "WP Test" dashboard, please contact your network administrator."

This with a freshly installed 3.5.1 wp.

The wp_usermeta table contains this, about that user:
+----------+---------+----------------------+------------+
| umeta_id | user_id | meta_key | meta_value |
+----------+---------+----------------------+------------+
| 17 | 2 | first_name | |
| 18 | 2 | last_name | |
| 19 | 2 | nickname | kate |
| 20 | 2 | description | |
| 21 | 2 | rich_editing | true |
| 22 | 2 | comment_shortcuts | false |
| 23 | 2 | admin_color | fresh |
| 24 | 2 | use_ssl | 0 |
| 25 | 2 | show_admin_bar_front | true |
| 29 | 2 | yim | |
| 30 | 2 | jabber | |
| 28 | 2 | aim | |
+----------+---------+----------------------+------------+

Please help!
Thanks!
Kate

  • aristath
    • Recruit

    Hello there Kate, I hope you're well today!

    Can you please verify that you've correcly entered the proper rewrite rules required by multisite in your .htaccess file?
    You can verify this by visiting Network Admin => Settings => Network Setup.
    Just grab the rules that say they must be in your .htaccess file, edit that file and replace any rules you already have there with the ones provided by WordPress.
    After you do that, please visit Settings => Permalinks, select a URL structure (postname is usually preferred) and save.

    Let me know if after that it works...

    Cheers,
    Ari.

  • Jozsef
    • WPMU DEV Initiate

    It was copy and paste. Everything is the same in the .htaccess file and the config file with the Network Setup page.
    The permalink was "Day and name" and still is.
    Nothing changed, still not working.

    htaccess:
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
    RewriteRule ^(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]

    multisite config:
    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', true);
    define('DOMAIN_CURRENT_SITE', 'a.b.c.hu');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);

  • Jozsef
    • WPMU DEV Initiate

    More info, what I do:
    I'm on the main page, go to my profile:
    http:// mainpage.url/wp-admin/user/profile.php
    I'm still on the main page url, select Your Avatar:
    http:// mainpage.url/wp-admin/user/profile.php?page=user-avatar

    mainpage.url means the main host url, in the config.php this is the: DOMAIN_CURRENT_SITE

  • aristath
    • Recruit

    This is what I did and it now seems to work:

    I tried uploading an avatar and at first I got the same error as you. On the crop screen the image was not displayed.
    I then saw this message on the page where I upload the avatar: If you are experiencing problems cropping your image please use the alternative upload method ("Alternative Upload" button).
    So... I tried it! When using the Alternative Upload button, the image was uploaded without any issues.
    I then tried uploading another image again, using the normal upload button.
    It worked without issues again...
    I guess that whatever was wrong got fixed by using the alternative upload method.

    Can you please try that and see if it works normally for you now?

    Cheers,
    Ari.

  • Jozsef
    • WPMU DEV Initiate

    Still, not. Are you sure, you not uploaded the file as admin?
    I tried as a simple user and with alternate upload the file was uploaded, but the crop page said I have no privileges to show that page.
    After that I saw that the picture was uploaded, but I could crop it.
    After that, as you said I tried the simple upload and it still don't work.

  • Ignacio
    • HummingBird

    Hi @Jozsef.

    The reason why I'm asking about FTP details is not only to update the plugin but to debug what's happening on your server when tries to render the avatar. Avatars use a special method to render those images and sometimes iit depends on the server setup to render it correctly. When I see a bug like that I have no other choice than see what's happening on the server.

    For the moment I fixed the "You attempted to access the "WP Test" dashboard, but you..." so that should be working fine but the images are being rendered good in all my tests.

    I'm attaching here the plugin but is going to be difficult to know why your images appear broken if I don't debug the code through FTP.

  • Jozsef
    • WPMU DEV Initiate

    Thanks, the fix is working, there are no alerts.
    The broken picture is still broken.
    Unfortunately I can't give ftp access (company policy)

    The broken picture url is:
    ../wp-content/uploads/avatars/user/92c/130315-1972stock_8.jpg
    if I remove the .. from the beginning, then the picture appears.

    The directory structure is:

    main_directory
    -- wp-admin
    -- wp-content
    -- uploads
    ---- avatars
    ------ blog
    ------- user
    -- wp-includes

    Nothing in the error log, the permissions are ok.

    What I found:
    we are here:
    /wp-admin/user/profile.php?page=user-avatar&action=upload_process
    the important thing is
    wp-admin/user/profile.php and not wp-admin/profile.php
    and when you include the picture on the crop page width ../, that just give us back with one level, so we are on the wp-admin.
    That's why the images are broken.

    From the access log:
    /wp-admin/user/profile.php?page=user-avatar&action=upload_process
    status 200 and then, the plugin search the image in here:
    wp-admin/wp-content/uploads/avatars/user/92c/image.jpg
    and it gives us a 404 status

    The site installed as multisite.

  • Ignacio
    • HummingBird

    Hi @Jozsef.

    Attached to this post there's a new version of Avatars Plugin ready to test. Normally we would test it (I've done it) but Avatars responds different in some servers so I prefer to send you the plugin and let you to make some testing. If everything works fine, I'll release a new version.

    Regards.
    Ignacio.

  • Jozsef
    • WPMU DEV Initiate

    Hi!

    I'm sorry, but there is still a bug.
    The subscriber now is ok, but now the blog owner can't upload an image. I can go to the crop page, I can crop, but when I want to save, then nothing saved and I see the default avatar picture.

    And there are some bugs in the code:
    In the plug_pages function you didn't set the $wp_version to global, so it is not exists there. Global missing in the process function too, there is a $current_site variable.
    And a little thing, the wp_clone, get_usermeta functions are deprecated.
    You have missing the $this-> in the Avatars function (this->__construct())

    Sorry,
    Kata

  • Ignacio
    • HummingBird

    Thanks @Jozsef!

    Here's the plugin with those fixes. I know this plugin is a little old and some refactoring and clean was needed but is a fragile plugin and just touching a little piece of code means that you're probably breaaking something else :slight_smile:

    Regards.
    Ignacio.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.