Advertisement
chrishajer

Attach the same file to all user notifications

Sep 3rd, 2013
662
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.56 KB | None | 0 0
  1. <?php
  2. // attach the same file to all User Notifications
  3. // add_filter("gform_notification", "add_attachment", 10, 3);
  4. function add_attachment( $notification, $form, $entry ){
  5.     // reference the notification by name
  6.     if( $notification["name"] == "User Notification" ){
  7.         // this is a path not a URL
  8.         $uploadDir =  get_stylesheet_directory();
  9.         // this is the file to be attached to all notifications
  10.         $attachment =  $uploadDir.'/terms.pdf';
  11.         $notification['attachments'] = array($attachment);
  12.     }
  13.     return $notification;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement