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.

Code in File

  1. I realize this might not be something that a lot of people come across, but as I sit and think about building 50-100 websites this coming year that will use GF -- I am wondering if it would be possible to include my support code in a text file instead of having to input it each time... or can I export that with the forms from the database too?

    Posted 9 years ago on Saturday December 5, 2009 | Permalink
  2. I wonder if there's a way to modify GF after you download it to preset that support code, so when you install it on every site, the code is preloaded. I wonder if there's a way to do it so it's inserted to the database upon installation, every time. You'd also need to remove the message that says "go buy a support license". I imagine with all the hooks built into GF that there is a way to do all this. I'm curious to know how as well.

    Posted 9 years ago on Saturday December 5, 2009 | Permalink
  3. The support license key is stored in the wp_option table with the "rg_gforms_key" name.
    So you could call:

    update_option("rg_gforms_key", md5('your key here'));

    to preload it, but I am not sure how this would save you time when you will have to write this code in all the sites anyways. It will probably be easier to type the key on the settings page.

    Scott's idea to keep it in a separate file could work, the problem is where would you save that file? it would have to be in a known location to Gravity Forms, but at the same time, it can't be in the gravityforms folder because the automatic upgrade would delete it.

    IAny suggestions.

    Posted 9 years ago on Sunday December 6, 2009 | Permalink
  4. I would download the GF plugin today, add that code to $some_file so it runs on GF installation, then rezip the plugin. Use that as your base for all installations. If they're all done while the GF version is current, then it doesn't change anything. Automatic updates would be fine because the option is stored in the database just as if you had typed it in manually. You just install from your local copy rather than downloading it 50-100 times (which I don't think Scott would do anyway.) Any problem doing it like that?

    You could run that update_option with some sort of post installation hook or something, right?

    Doesn't really seem that complicated, other than knowing when to run that update_option, post installation, unless I am overlooking something.

    Posted 9 years ago on Sunday December 6, 2009 | Permalink
  5. You are right, that would work. You would want to put the update_option line in the gravityforms.php file, right under the call to

    self::fix_checkbox_value();

    so that it looks like the following:

    self::fix_checkbox_value();
       update_option("rg_gforms_key", md5('your key here'));
    Posted 9 years ago on Sunday December 6, 2009 | Permalink
  6. That's excellent. I have a need to do this myself, so this is great news. Hope it works for Scott too.

    Posted 9 years ago on Sunday December 6, 2009 | Permalink