Last active
August 29, 2015 14:23
-
-
Save nmedia82/2413afbc20bb7559de12 to your computer and use it in GitHub Desktop.
N-Media File upload and download manager plugin hooks - wordpress plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// visit plugin url: http://najeebmedia.com/wordpress-plugin/wp-front-end-file-upload-and-download-manager/ | |
/** | |
* change FROM EMAIL | |
* Notification when file uploaded by user | |
**/ | |
add_filter('fileupload_from_email', 'change_from_email'); | |
function change_from_email($dedault_email){ | |
return '[email protected]'; | |
} | |
/** | |
* change Subject | |
* Notification when file uploaded by user | |
**/ | |
add_filter('fileupload_subject', 'change_subject', 10, 2); | |
function change_subject($dedault_subject, $file_name){ | |
return 'A new file ' . $file_name . ' is uploaded '; | |
} | |
/** | |
* change Recipients | |
* Notification when file uploaded by user | |
** receivers - Array | |
**/ | |
add_filter('fileupload_receivers', 'change_receivers'); | |
function change_receivers($dedault_receivers){ | |
$dedault_receivers[] = '[email protected]'; | |
return $dedault_receivers; | |
} | |
/** | |
* change email message (body) | |
* Notification when file uploaded by user | |
* $file_data - Array with following keys | |
** title | |
** filename | |
** file_meta (key, value) | |
**/ | |
add_filter('fileupload_message', 'change_message', 10, 2); | |
function change_message($message, $args){ | |
$file_meta = ''; | |
if($args){ | |
foreach($args['file_meta'] as $key => $val){ | |
$file_meta .= $key .': '.$val.'<br>'; | |
} | |
$message .= '<br>' . $file_meta; | |
} | |
return $message; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment