Michael,
Ok, that worked. Following are my changes and the resulting change in the output. Please post a reply if you see any potential issues with these changes. Also feel free to incorporate any of this in future releases.
To summarize, the change we were looking for was to include the user's real name in the email notification sent when a user uploads a file. The reason for this was to make it easier to correlate usernames with real users since people sometimes choose strange usernames. It saves having to manually look up usernames to find their associated real name.
The email notification output changes from this:
The following files where uploaded by [username]:
path/to/jfu/upload/dir/photo.jpg – [user's file description]
to this:
The following files where uploaded by customer: [user's name], username: [username]
path/to/jfu/upload/dir/photo.jpg – [user's file description]
These are the component changes to make this happen:
administrator/components/com_joomla_flash_uploader/admin.joomla_flash_uploader.php
replace:
Code:
$my = $mainframe->getUser();
$_SESSION["TFU_USER"] = $my->username . " (backend)";
$_SESSION["TFU_USER_ID"] = $my->id;
with
Code:
$my = $mainframe->getUser();
$_SESSION["TFU_USER"] = $my->username . " (backend)";
$_SESSION["TFU_USER_ID"] = $my->id;
$_SESSION["TFU_USER_NAME"] = $my->name; // get user's name
administrator/components/com_joomla_flash_uploader/tfu/tfu_config.php
replace:
Code:
$upload_notification_email_text = 'The following files where uploaded by %s: %s:';
with:
Code:
// add placeholders for user's name, name and username labels, and all associated punctuation
$upload_notification_email_text = 'The following files where uploaded by %s: %s, %s: %s %s';
IMPORTANT: post JFU install, make this change in the Joomla administration under Components > JFU > Config > [default profile] > Flash Uploader Settings > Notification text:
The following files where uploaded by %s: %s, %s: %s %sadministrator/components/com_joomla_flash_uploader/tfu/tfu_upload.php
replace:
Code:
$username = (isset($_SESSION['TFU_USER'])) ? $_SESSION['TFU_USER'] : $_SERVER['REMOTE_ADDR']; // if we don't have a use we use the IP
$mailtext = sprintf($upload_notification_email_text, $username , $filestr);
with:
Code:
$jfu_name_label = 'customer'; // user's name label
$jfu_name = (isset($_SESSION['TFU_USER_NAME'])) ? $_SESSION['TFU_USER_NAME'] : $_SERVER['REMOTE_ADDR_NAME']; // user's name
$jfu_username_label = 'username'; //username label
$username = (isset($_SESSION['TFU_USER'])) ? $_SESSION['TFU_USER'] : $_SERVER['REMOTE_ADDR']; // if we don't have a use we use the IP
$mailtext = sprintf($upload_notification_email_text, $jfu_name_label, $jfu_name , $jfu_username_label, $username, $filestr); // add user's name and associated labels
components/com_joomla_flash_uploader/joomla_flash_uploader.php
replace:
Code:
$my =& JFactory::getUser();
$_SESSION["TFU_USER"] = $my->username;
with:
Code:
$my =& JFactory::getUser();
$_SESSION["TFU_USER"] = $my->username;
$_SESSION["TFU_USER_NAME"] = $my->name; // get user's name
and:
Code:
JFUHelper::setJFUSession($row, $folder);
$_SESSION["TFU_FILE_CHMOD"] = JFUHelper::getVariable($database, 'file_chmod');
$_SESSION["TFU_DIR_CHMOD"] = JFUHelper::getVariable($database, 'dir_chmod');
unset($_SESSION["IS_ADMIN"]);
$_SESSION["IS_FRONTEND"] = "TRUE";
if ($user->id != 0) {
$_SESSION["TFU_USER"] = $user->username;
$_SESSION["TFU_USER_ID"] = $user->id;
} else {
unset($_SESSION["TFU_USER"]);
unset($_SESSION["TFU_USER_ID"]);
}
with:
Code:
JFUHelper::setJFUSession($row, $folder);
$_SESSION["TFU_FILE_CHMOD"] = JFUHelper::getVariable($database, 'file_chmod');
$_SESSION["TFU_DIR_CHMOD"] = JFUHelper::getVariable($database, 'dir_chmod');
unset($_SESSION["IS_ADMIN"]);
$_SESSION["IS_FRONTEND"] = "TRUE";
if ($user->id != 0) {
$_SESSION["TFU_USER"] = $user->username;
$_SESSION["TFU_USER_NAME"] = $user->name; // set user's name
$_SESSION["TFU_USER_ID"] = $user->id;
} else {
unset($_SESSION["TFU_USER"]);
unset($_SESSION["TFU_USER_NAME"]); // unset user's name
unset($_SESSION["TFU_USER_ID"]);
}
Again, any issues, please point them out. Otherwise feel free to use in future versions. Happy uploading!