Index: filefield_widget.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/filefield/filefield_widget.inc,v retrieving revision 1.77 diff -u -r1.77 filefield_widget.inc --- filefield_widget.inc 4 Apr 2009 05:45:32 -0000 1.77 +++ filefield_widget.inc 8 Apr 2009 18:39:04 -0000 @@ -108,16 +108,18 @@ /** * Determine the widget's files directory * - * @param $field + * @param $field_instance * A CCK field array. + * @param $account + * The user account object to calculate the file path for. * @return * The files directory path, with any tokens replaced. */ -function filefield_widget_file_path($field_instance) { +function filefield_widget_file_path($field_instance, $account = NULL) { + $account = isset($account) ? $account : $GLOBALS['user']; $dest = $field_instance['widget']['file_path']; if (module_exists('token')) { - global $user; - $dest = token_replace($dest, 'user', $user); + $dest = token_replace($dest, 'user', $account); } return file_directory_path() .'/'. $dest;