I’ve a multisite installation of Drupal 5.x, a modified Garland theme and user pictures (avatars) enabled. Till now, I used a single “/files” directory for all sites…yes, it sounds freaky (and it’s). I want to enable image upload, so now I want to create something like “files/my1stsite” without Drupal explodes. How to do that?
- If you have enabled CSS compression in admin/settings/performance, disable it
- Copy (not move!) the user picture folder (i.e. avatar) to “files/my1stsite”. Note: you have to make files and folder writable, if they aren’t: if you omit this step, users cannot change their avatar.
- (recommended) Put your site offline to prevent changes.
- Change manually all the user pictures path on the database table drp_shared_users, field “picture”. Before: files/avatar/picture-… After: files/my1stsite/avatar/picture-… Existing users images now are taken from the new folder.
- Go to admin/settings/file-system and set the new system path (i.e. “files/my1stsite”). Now even new users pictures go in the new folder.
- Go to admin/user/settings, verify the users pictures path and save.
- Go to admin/build/themes/settings/garland and save. It’ll create a “color” folder in the new system path, regenerating the theme.
- If you use image cache, you have to go to admin/settings/imagecache and update all your presets. Check any other module that uses the files directory.
- Put online your website. Now you can reactivate CSS compression.
Use this tutorial at your own risk.
Important: if you have a shared user table, avatars will be only visible in the site where users uploaded them
, due to the (questionable?) choice to store a relative path in user tables.
UPDATE: to solve the latest problem, you’ve to patch user.module:
$picture = file_create_url($account->picture);
#patch to multisite user picture de-linked
$picture = $account->picture;
If you use site user list, you’ve to change on admin/settings/site_user_list/fields the template value from:
<img src=”@_base/@picture” alt=”” />
<img src=”@picture” alt=”” />
suppressing @_base value. Note: giving an “alt” value is good for accessibility, so do it. You can also link user profile wrapping image in a “<a href=”user/@uid”>” or “<a href=”user/@name”>” (if you use URL rewrite).