I have done a multisite setup like this:

sites/drupaltest.com
sites/site1.drupaltest.com
sites/site2.drupaltest.com

settings.php in each site has been modified to allow sharing some tables across the subdomains:

$db_prefix = array(
'default'   => 'site1_',     // site2_  etc...
'users'     => 'shared_',
'sessions'  => 'shared_',
'role'      => 'shared_',
'authmap'   => 'shared_',
'sequences' => 'shared_',
'profile_fields' => 'shared_',
'profile_values' => 'shared_',
'users_roles' => 'shared_',);

cookie_domain has also been set to allow one time login.

I have also enabled

  • Profiles module, and added an age field.
  • Picture Support under Adminster > User Management > User Settings

Sequence to generate the unexpected result:

  • User1 logins at site1.
  • User1 surfs to site2. (he is authenticated at site2, and doesn't have to login again, OK)
  • User1 edits profile, and enters 20 for the age field.
  • User1 adds an avatar. (Note that he adds it at site2, and Drupal saves the avatar file to sites/site2.drupaltest.com/files/pictures)
  • User1 views his profile at site2. (He sees the age field - 20, and also his avatar displayed, OK)
  • User1 surfs back to site1, and views his profile at site1. (He sees the age field - 20, but his avatar isn't displayed, NOT OK. A hyper linked text - user1's picture, appears where the avatar should. Checking the URL of this reveals : http://site1.drupaltest.com/sites/site1.drupaltest.com/files/sites/site2...
  • As a comparison, the URL of the avatar at site2 is:
    http://site2.drupaltest.com/sites/site2.drupaltest.com/files/pictures/pi...

Does anyone know what is going on?

I would expect the avatar to be shown across all subdomains, like the profile field values (i.e. the age - 20, in this example)

Thank you.

Comments

davidhernandez’s picture

Hi,

The fields attached the user profile will work ok because they are stored in the database and you are using the same database tables for the user in both sub sites. The problem is if the file path is being stored relative the the subsite (sites/site2.drupaltest.com/files/pictures.) Site1 cannot reach the files in site2 and vice versa. I would think the solution is to have the files stored in a directory that both sites can easily reach. For example, drupal/files, instead of drupal/sites/site2.drupaltest.com/files. Do you have access to the database? You can check the path being stored there.

ThePiano.SG’s picture

Yes, I do have access to the database:

Table site2_variable > user_picture_path has a value of s:8:"pictures";.

How will I be changing it to enable the picture be stored under one directory?

Thank You.

davidhernandez’s picture

You'll want to check the files table, or in your case it is probably site1_files and site2_files. This should be where the actual path to the file is stored. What is your configuration for the "file system" section of both sites? Are they set the same? Are they public or private? Have the same path, etc?

alexanderpas’s picture

the requested behaviour is sadly currently not possible...
a feature request has been made at #132988: Allow specifying a global directory for user pictures ($100 bounty for D5)

less == more