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.

Multiple gform_post_submission in plugin

  1. SqueezeDigltal
    Member

    Hi,
    I have made a plugin for gform_post_submission as follows:

    add_action("gform_post_submission_1", "post_submission", 10, 2);
    	function post_submission($lead, $form) { }

    ...works great, however I have 3 forms which i want to post to 3 different places. Can i add 3 hooks in the same plugin? eg.

    add_action("gform_post_submission_1", "post_submission", 10, 2);
    	function post_submission($lead, $form) { }
    
    add_action("gform_post_submission_2", "post_submission", 10, 2);
    	function post_submission($lead, $form) { }
    
    add_action("gform_post_submission_3", "post_submission", 10, 2);
    	function post_submission($lead, $form) { }

    or would i need to create a seperate plugin for each?

    Many thanks,

    Posted 12 years ago on Tuesday July 5, 2011 | Permalink
  2. Yes, you can have 3 different actions, one for each form, in your custom plugin. Just note you are creating the same function 3 times. So you may receive an error because post_submission would already exist.

    Posted 12 years ago on Tuesday July 5, 2011 | Permalink
  3. SqueezeDigltal
    Member

    Good point. Thanks Carl.

    Posted 12 years ago on Wednesday July 6, 2011 | Permalink