Support » Plugin: GiveWP - Donation Plugin and Fundraising Platform » Hook to create new form in background

  • Is there a hook that when called will create a form using the template settings? I want this to happen in the background after other user action. I do not need the user to visit the form creation page, only the finished form … which implies I need to get the form_ID back in response to the hook. Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Matt Cromwell


    Try using our free Give Hook Helper plugin to look for what you need:

    If that doesn’t get you where you need to go, then please be a bit more detailed in exactly what you are looking for, how we can recreate it, what the results might be from a DONOR or ADMIN perspective.


    Thread Starter oregondean


    Thank Matt for your quick reply. The Hook Helper is quite intriguing for other work. But in my case we do not have a single Admin, rather we have multiple Campaign Organizers.

    The Organizer will have created an account on our site and then filled in a short Gravity Form collecting other aspects of their Campaign (baby due date, etc.).

    After that form is submitted I want to call a WP hook to automatically create a new GiveWP Form (Campaign) using template data. I’d like to receive the form ID back in response to that call.

    I will write a small custom function to update their campaign _give_set_goal and _give_form_content from the Gravity Form they used to share other aspects of their Campaign.

    The Organizer and Donor will only be directed to the Campaign Donation page. We have some flow refinements to do for Organizers who need to come back to update and complete the Campaign information Gravity Form, but they will not be directed back to the Give form certain/edit page – too many choices – we need to keep it simple.

    FWIW, this hook is about Core … but we did become 5 site premium members yesterday. Love this plugin!

    Thread Starter oregondean


    It looks like there are a few other fields we will update in our custom function including _give_donation_levels to pre-populate the Donation levels. We’ve configured a form that we can use as a template to update the values in the new form that are not part of GiveWP’s settings. I’m somewhat handy in PHP and mySQL so we will likely use our custom function to copy from that “template” form so if things change in our template or in the GiveWP app we can easily adjust.

    I suppose another alternative – if there is a hook to call your recalculate function – is to find a hook that duplicates a form (see below), update the values using our custom function as described above, and then using the hook to recalculate. But this all needs to happen in PHP.

    This would be my start for that solution

    Plugin Contributor Kevin Hoffman


    Hi there, I also wanted to let you know we have a new “Duplicate Form” feature coming to Give 2.2.0 which is releasing soon, so you’ll be able to duplicate forms without the need of third-party plugins. The benefit to using this new feature is that we have accounted for the form meta that needs duplicated (such as form settings) while ensuring that any donation stats associated with the form are properly reset in the new form.

    You might find our new Give_Form_Duplicator class very helpful given your idea of cloning from a template form. Here’s a link to check it out. Note this is still pre-release code and subject to change:

    Thread Starter oregondean


    That’s awesome. Thanks! As I have worked though this for my application it looks like I am proceeding using some direct WordPress mySQL database access to duplicate the form inside wp_posts and wp_give_formmeta. Since the new form will have it’s own ID and name I am presuming your statistics will simply incorporate new activity properly. I’ve set the donor sales count and earnings amounts to zero in the new form. I’m using a Filemaker script.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Hook to create new form in background’ is closed to new replies.