Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // create custom notification which includes only submitted fields
- // change the 487 here to your form ID
- add_filter('gform_notification_487', 'custom_format', 10, 3);
- function custom_format($notification, $form, $entry) {
- // be sure this is the name of your notification, change it if not
- if($notification['name'] == 'Admin Notification'){
- $notification['message_format'] = 'html';
- $notification['message'] = '<table width="600" border="0">';
- foreach ($entry as $key => $value) {
- // only output form fields, not entry meta
- if (is_numeric($key)) {
- // trim whitespace from $value
- $value = trim($value);
- // if the value is not empty for this field, add it to the notification
- if(!empty($value)) {
- // get the field information from the form
- $field = RGFormsModel::get_field($form, $key);
- // add a line to the notification
- $notification['message'] .= "<tr><td>" . $field['label'] ."</td><td>$value</td></tr>";
- }
- }
- }
- $notification['message'] .= '</table>';
- }
- // return the notification either way
- return $notification;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement