Advertisement
chrishajer

Attach the same file to all user notifications

Sep 3rd, 2013
480
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data Copied
Advertisement