I'm trying to generate the path for a file based on a user which isn't currently logged in. filefield_widget_file_path() uses the currently logged in user; is there any reason why $user can't be a function parameter? If not, let me know and I'll work on a patch.

Thanks!

CommentFileSizeAuthor
#2 419616_account_parameter.patch1.07 KBdeviantintegral
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

Category: bug » feature

I'd be happy to change this to using an $account parameter.

function filefield_widget_file_path($field_instance, $account = NULL) {
  $account = isset($account) ? $account : $GLOBALS['user'];

Patchin' finger is ready. ;-)

deviantintegral’s picture

Status: Active » Needs review
FileSize
1.07 KB

Here it is! I've also corrected the phpdoc for the first parameter.

quicksketch’s picture

Status: Needs review » Fixed

Thanks, committed!

frankcarey’s picture

Nice, I just realized i needed this, thanks guys :)

frankcarey’s picture

I noticed that field_file_save_file() suffers from the same issue?
#439952: Global user used to set the $file->uid]

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.