Nice plugin. Many Thanks.
But an upload-notifacation would be very important for me too!
https://wordpress.org/plugins/file-away/
Add me to this, I would like to see a way to associate an email notification with a particular file upload. Ideally this could be picked from the User table.
Here’s a quick mod:
Open up wp-content/plugins/file-away/lib/cls/class.fileaway_management.php
go to about line 1118 and change this:
if(move_uploaded_file(strip_tags($_FILES['upload_file']['tmp_name']), $location)) echo $file_id;
to this:
if(move_uploaded_file(strip_tags($_FILES['upload_file']['tmp_name']), $location))
{
do_action('fileup_after_upload', $location);
echo $file_id;
}
Then, in your theme’s functions.php, add this little class and modify the notification function as desired:
class my_custom_fileup_hook
{
public function __construct()
{
add_action('fileup_after_upload', array($this, 'upload_notification'));
}
public function upload_notification($location)
{
global $current_user;
$recipients = 'your@email.com';
// $recipients = get_option('admin_email');
$name = $current_user->ID ? $current_user->display_name : 'Guest';
$timestamp = current_time('mysql');
$subject = $name.' uploaded a file on '.$timestamp;
$body = $name.' (user '.$current_user->ID.') uploaded a file.';
$body .= "\n";
$body .= 'Timestamp: '.$timestamp;
$body .= "\n";
$body .= 'Location: '.$location;
mail($recipients, $subject, $body);
return;
}
}
new my_custom_fileup_hook;
I’ve commented out $recipients = get_option('admin_email'); If you want the recipient to just be the current admin email, uncomment that line. Otherwise, hard code the email as exampled.
Hi,
thanks for your help!
Works fine, exactly what I need!
Great job, that works fine. Many thanks!
I followed these directions, and they work great.
However, I was wondering if there is a way to make the “location” that appears in the email hyperlink to the file location? Right now, it’s not exactly the correct URL, and it’s not a hyperlink.
I’m using FileAway on a subdomain, so my situation might be a little unique, but the location that appears in the email looks like:
/home/content/90/2503490/html/mysubdomain.example.com/base-directory-folder/client/file.pdf
I would like it to be:
mysubdomain.example.com/base-directory-folder/client/file.pdf
In the File Away settings, “/home/content/90/2503490/html” is hard-coded for me, I’m assuming maybe because of where the plugin is installed…?
Thank you for the info.
I added ’email notice’ to site admin by following the info within a minute or two.
Fileaway is such a wonderful plugin. Much appreciated!
is email-notice possible for ‘delete operation’ as well?