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.

Register datas in another database (not Wordpress)

  1. hurraken
    Member

    Hello,

    How can i register the datas of my forms in another database. I don't want to stock them in the WP database.

    Thank you for your help.

    Posted 12 years ago on Tuesday November 8, 2011 | Permalink
  2. You would use the gform_after_submission hook to send the data to the external database, after the data is submitted. That hook is available in 1.6 and later. It was previously called gform_post_submission.

    If you're concerned about the entry being stored in the WordPress as well (using this hook would send data elsewhere, but it the entry is still stored in your WordPress database) here is the code to delete the entry immediately after creation. There is no provision to NOT create the entry, but you can remove it immediately after creation if you like.

    Posted 12 years ago on Tuesday November 8, 2011 | Permalink
  3. hurraken
    Member

    Thank for your answer.

    I can't succeed in realizing that. I have a low level in PHP. I know how to create the second database and put the code in functions.php but i would be able to create the function...

    But i'm sure a lot of people would be interesting in this function.

    Anyway, thank you !

    Posted 12 years ago on Tuesday November 8, 2011 | Permalink
  4. Hi Chris/Gravityforms people

    This function is also something that would help me a lot. Any more info would be appreciated.

    Thanks

    Paddy Lynch

    Posted 12 years ago on Tuesday November 8, 2011 | Permalink
  5. Excuse my ignorance, as I'm a bit of a beginner when it comes to php.

    I've been given a plugin 'leadmanager' that my client wants to call after every form submission. So, from reading the documentation, in order to invoke this 'leadmanager' function to work in all my forms I need to add

    "add_action("gform_after_submission", "leadmanager", 10, 2);
    function leadmanager ($entry, $form) {leadmanager code blah blah blah}"

    To my functions.php (in my wordpress themes folder)? Is that correct?

    Posted 12 years ago on Tuesday November 8, 2011 | Permalink
  6. Thats correct. You'd need to know what code you need to execute and execute it using the gform_after_submission hook which gets fired after the form has been submitted.

    Posted 12 years ago on Tuesday November 8, 2011 | Permalink
  7. Thanks Carl,

    I believe I'm getting the code for the leadmanager function I mentioned tomorrow (is this what you're referring to when you say 'what code you need to execute'?) , so I'll let you know how it progresses.

    Posted 12 years ago on Tuesday November 8, 2011 | Permalink
  8. hurraken
    Member

    The code to execute after the gform_after_submission hook have to send datas to the other DB and delete datas in the WP DB but i don't know to realize that.

    Posted 12 years ago on Wednesday November 9, 2011 | Permalink
  9. @hurraken, I'm afraid I don't understand your question or what you need to accomplish exactly. Can you add more details please? Thank you.

    Posted 12 years ago on Wednesday November 9, 2011 | Permalink
  10. hurraken
    Member

    Hello Chris,

    I have a form. I'd like to pass the datas that the users enter to an external Database and delete those which are registered in the WP database.

    Thank you again for your help.

    Regards.

    Posted 12 years ago on Wednesday November 9, 2011 | Permalink
  11. @hurraken You need to use the gform_after_submission hook to execute your own custom code that takes the data and inserts it into your external database. Documentation for the gform_after_submission hook can be found here:

    http://www.gravityhelp.com/documentation/page/Gform_after_submission

    If you want to then delete the entry in the Gravity Forms tables in your WordPress database here is a post that discusses how to do this:

    http://www.gravityhelp.com/forums/topic/purposefully-not-save-form-in-entries-database#post-15601

    Ultimately what you want to do requires custom code that you will have to write to interact with your external database.

    Posted 12 years ago on Wednesday November 9, 2011 | Permalink
  12. hurraken
    Member

    Hi Carl,

    I understood everything since your first post, the only thing i can't do, it's to write the code to connect to the other database and register the datas in.

    I thought to have a little bit help (from the customer service or customers) to guide me to write this code.

    I can understand that you help for the plugin's bugs and not to develop applications around it.

    I'll see if i can have help in another place.

    Regards.

    Posted 12 years ago on Wednesday November 9, 2011 | Permalink
  13. Custom code to connect to, interact with and store data in a 3rd party database is a customization. It's not built in functionality of Gravity Forms and not a built in feature so it's outside the scope of support.

    Customizations are customizations and while we can provide high level guidance on what you need to do, ultimately you or a developer you hire would have to write the custom code necessary to implement the customization.

    Posted 12 years ago on Wednesday November 9, 2011 | Permalink