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!

Files: 
CommentFileSizeAuthor
#2 419616_account_parameter.patch1.07 KBdeviantintegral

Comments

Category:bug» feature

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

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

Patchin' finger is ready. ;-)

Status:Active» Needs review
StatusFileSize
new1.07 KB

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

Status:Needs review» Fixed

Thanks, committed!

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

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.