Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum

Get help for TinyWebGallery, the best image gallery. The forum is also home for the Joomla JFUploader, TWG Flash Uploader and the Wordpress flash uploader.
It is currently 19. Apr 2024, 10:02

This forum is readonly now. Please use the new forum if you don't find the answer to your question here. The new forum is at https://www.tinywebgallery.com/blog/forum/


All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: 16. Mar 2009, 17:58 
Offline

Joined: 16. Mar 2009, 02:45
Posts: 4
Hi Michael-
I have modified the email notification field in the Admin panel to read:
The following file was uploaded: $%s; $%2s

But I think I must have the wrong Syntax, I get the email fine, just no file details.

What is the proper way to enter notification text for username and file detail?

Thanks-
MDS


Top
 Profile  
 
 Post subject:
PostPosted: 16. Mar 2009, 18:30 
Offline
Site Admin
User avatar

Joined: 1. Aug 2005, 12:53
Posts: 11232
There is no $

e.g.

The following files where uploaded by %s: %s

first %s is the user
2nd %s are the files

Like described in the description ;).

- Michael


Top
 Profile  
 
 Post subject:
PostPosted: 3. Jun 2009, 19:17 
Offline

Joined: 3. Jun 2009, 02:13
Posts: 18
Is there a way to add the user's real/registered name AND their username to the email?


Top
 Profile  
 
 Post subject:
PostPosted: 3. Jun 2009, 19:51 
Offline
Site Admin
User avatar

Joined: 1. Aug 2005, 12:53
Posts: 11232
you would have to add this to the joomla wrapper part and then read it where the email is created.

- Michael


Top
 Profile  
 
 Post subject:
PostPosted: 3. Jun 2009, 21:09 
Offline

Joined: 3. Jun 2009, 02:13
Posts: 18
So if I read the user's name in from Joomla and assign it to a variable in my_tfu_config.php (say $jfu_user) I can add that variable to the mail message constructor in tfu_upload.php:

Code:
$mailtext = sprintf($upload_notification_email_text, $jfu_user , $username , $filestr);


Then adjust my notification value to read something like "The following files where uploaded by %s: %s: %s". Am I on the right track?


Top
 Profile  
 
 Post subject:
PostPosted: 3. Jun 2009, 21:20 
Offline
Site Admin
User avatar

Joined: 1. Aug 2005, 12:53
Posts: 11232
would work - you can do everything analog to the userlogin.

- Michael


Top
 Profile  
 
PostPosted: 9. Jun 2009, 00:20 
Offline

Joined: 3. Jun 2009, 02:13
Posts: 18
Michael,

So I'm still working on this little enhancement. In the email notification sent when a user uploads a file, we currently get their username. We also want their name. I have figured out one way to get an extra variable into the email, but I cannot figure out how to get JFU to read in the global $my->name value from the jos_users table.

Here's what I have so far:

In administrator/components/com_joomla_flash_uploader/tfu/tfu_upload.php I've declared a new variable $jfu_user that I intend to contain the global $my->user value from the DB. I've also changed:

Code:
$mailtext = sprintf($upload_notification_email_text,  $username , $filestr);


to:

Code:
$mailtext = sprintf($upload_notification_email_text,  $username, $jfu_user , $filestr);


In the JFU configuration I've changed the value of Notification Text from:

The following files where uploaded by %s: %s

to:

The following files where uploaded by %s: %s: %s

This works in that I can pass a value to $jfu_user and it is included in the email notification, but I have tried all of the normal Joomla ways to get the global $my->user value and pass it to $jfu_user without success.

As script somewhere obviously gets the $my->username (perhaps joomla_flash_uploader.class.php or admin.joomla_flash_uploader.php), which as far as I can tell is stored in $_SESSION['TFU_USER']. How can I do the same for the user's real name?

BTW, the reason we want this enhancement is to make it easier to match each job with a real customer. Right now we have to manually match up the JFU username with a real name. Customers sometimes choose strange usernames and having their real name in the email would be easier. :wink:


Top
 Profile  
 
 Post subject:
PostPosted: 9. Jun 2009, 07:51 
Offline
Site Admin
User avatar

Joined: 1. Aug 2005, 12:53
Posts: 11232
do it like for the username - put it to the session and read it like it do - only 2 small changes.

- Michael


Top
 Profile  
 
 Post subject:
PostPosted: 9. Jun 2009, 20:14 
Offline

Joined: 3. Jun 2009, 02:13
Posts: 18
Thanks! Just clue me in a little more, which files - tfu_upload.php and joomla_flash_uploader.class.php? I see what looks like global user definitions in admin.joomla_flash_uploader.php also. Is that file relevant to this change?


Top
 Profile  
 
 Post subject:
PostPosted: 9. Jun 2009, 22:02 
Offline
Site Admin
User avatar

Joined: 1. Aug 2005, 12:53
Posts: 11232
search for TFU_USER in all files and make in like there.
There are a couple of places where you have the change this.

- Michael


Top
 Profile  
 
 Post subject:
PostPosted: 11. Jun 2009, 02:58 
Offline

Joined: 3. Jun 2009, 02:13
Posts: 18
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 %s

administrator/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! :)


Top
 Profile  
 
 Post subject: Email confirmation
PostPosted: 11. Jun 2009, 03:13 
Offline

Joined: 3. Jun 2009, 02:13
Posts: 18
One last note about emails. This might belong in another forum, but here goes:

We require that new users confirm their registration via a confirmation email. This is sent by Community Builder. Evidently, JFU adds new users to the default profile before they've had a chance to self confirm. JFU sends a notice to the new user about this. (I may not be exactly accurate about the sequence here, but the JFU email can arrive before CB account activation.) If the new user gets that email ahead of confirming their registration via the Community Builder email, the user gets an error if attempting to use the JFU. The problem is solved, of course, as soon as they confirm their registration, but it does introduce a potential usability flow issue. We've updated our error codes in /language/en-GB/en-GB.com_joomla_flash_uploader.ini to better handle usability issues and instruct users about what to do, but just FYI. ;)


Top
 Profile  
 
 Post subject:
PostPosted: 11. Jun 2009, 09:03 
Offline
Site Admin
User avatar

Joined: 1. Aug 2005, 12:53
Posts: 11232
Where does the user get an e-mail from JFU? JFU does only send something AFTER you upload something - and he does not have access before he confirms his account.

So I don't understand how your issue before can happen.

- Michael


Top
 Profile  
 
 Post subject:
PostPosted: 11. Jun 2009, 09:04 
Offline
Site Admin
User avatar

Joined: 1. Aug 2005, 12:53
Posts: 11232
and you should not use %s for a constant like customer - this is confusing ...

- Michael


Top
 Profile  
 
 Post subject:
PostPosted: 11. Jun 2009, 09:39 
Offline

Joined: 3. Jun 2009, 02:13
Posts: 18
TinyWebGallery wrote:
Where does the user get an e-mail from JFU? JFU does only send something AFTER you upload something - and he does not have access before he confirms his account.

So I don't understand how your issue before can happen.

- Michael


Sorry, my mistake. The user gets a second email from Community Builder (not JFU), where we've added a note about JFU. Could be what's happening is that users attempt to use the JFU before they've activated the new account. This is not a JFU issue, you are correct.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron
powered by phpbb | Datenschutz/ Privacy policy