Pictures Directory for Drupal site users.

davecoventry's picture

He has: 112 posts

Joined: Jun 2009

Currently I have the users avatars kept in sites/www.webmaster-forums.net/files/pictures

I want to have the users place their pictures in sites/www.webmaster-forums.net/files/pictures/user_name/

How does one go about this?

Do you alter the file_directory_path variables?

davecoventry's picture

He has: 112 posts

Joined: Jun 2009

I've solved this with another dreadful hack.

I've created a new table: drup_picture_files with fields name, type, path.

I've created the new directory sites/default/files/picture/users/username

I've use file_save_upload to allow the user to upload the file

I've added the user name, type and path to the drup_picture_files table.

And for the avatar, I've used a SQL UPDATE to set the user's picture field to the sites/default/files/picture/users/username directory. Seems to work.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.