PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Email/Message Filters

  1. Currently, GFCommon::send_email() is a private method and probably rightly so. However, there is no real way to modify the message contents without re-writing this method. Just something to re-considered because I am betting this was made private on purpose to prevent plugins, etc., from using this method.

    However, I believe it would be advantageous to add a filter to the message though I am not sure which would be better, pre-replace_variables() or post. However, I do think that message could benefit from its own method. Something like this:

    public static function build_message( $form, $lead ){
    
    	$message_format = apply_filters("gform_notification_format_{$form["id"]}", apply_filters("gform_notification_format", "html", "admin", $form, $lead), "admin", $form, $lead);
    	$message = GFCommon::replace_variables(rgget("message", $form["notification"]), $form, $lead, false, false, !rgget("disableAutoformat", $form["notification"]), $message_format);
    	$message = do_shortcode($message);
    
    	return apply_filters("gform_message_{$form["id"]}", apply_filters("gform_message", "html", "admin", $message), "admin", $message);
    }

    This could replace 2 chunks in send_user_notification() & send_admin_notification() methods. This would also allow someone to hit gform_entry_created and make the necessary changes to the message based on the submission.

    Posted 12 years ago on Saturday June 9, 2012 | Permalink