Google Forms v0.65 finally released

This morning I released v0.65 of Google Forms, a long overdue update.  I have been sitting on this release for a while because of one outstanding issue I was aware of which I simply haven’t had time to chase down.  The ability to email the end user upon form submission broke at some point, I am not exactly sure when but it has been reported a few times recently.  It turns out, it only worked if email to the admin was also enabled.

Here are the highlights from the Change Log:

  • Implemented “save_post” for custom post type eliminating general purpose “save_post” (only option prior to WordPress 3.7) action which could potentially, if not handled correctly by another plugin, corrupt post data.
  • Formally deprecated the gform shortcode by updating README file.
  • Added flush of rewrite rules upon plugin activation and deactivation.
  • Implemented protocol relative URLs for loading jQuery script from Microsoft CDN to avoid mixed-content warnings when serving over https.
  • Fixed layout of CAPTCHA options on settings page.
  • Fixed bug with preset values as part of the URL which contain spaces.
  • Fixed bug sending End User email upon form submission.
  • Refactored construction of email headers based on experience with Email Users plugin.

You can find the update in the WordPress plugin repository or on your WordPress Dashboard.

Google Forms v0.65-beta-3 available

This morning I posted beta-3 of Google Forms.  This latest beta addresses an issue reported on the Google Forms Support Forum where extra URL parameters would result in the form not being rendered.

Google Forms has supported additional URL parameters for a while as a mechanism to preset form values.  The problem turned out to be that parameters which contained spaces weren’t being handled properly which resulted in a bad URL.  The bad URL was then used to retrieve the Google Form which failed and resulted in the form not displaying.

This build properly handles spaces in URL parameters and Google ignores, as expected, any parameters it doesn’t know what to do with.  So in the case reported on the Support Forum, the extra parameters added by MailChimp will simply be ignored.

Google Forms Beta (579 downloads)

Google Forms v0.65-beta-2 available

I received a patch over the weekend from a Google Forms user which I have incorporated into beta-2 of v0.65.  The patch changes how Google Forms loads the jQuery Validation plugin from the Microsoft CDN.  The plugin is now loaded using a protocol relative URL.  This change will eliminate the mixed content message which appears on sites using HTTPS.

There are a couple other minor fixes in this build as well, the most notable a flush of re-write rules upon plugin activation or de-activation in hopes that it will eliminate one of the most common questions I receive (why doesn’t my URL work when I click the View Form button?).

Google Forms Beta (579 downloads)

Google Forms v0.65-beta-1 available

Shortly after releasing v0.64 I received a report of data corruption from a Google Forms user.  I took this report very seriously and immediately reverted the stable tag for Google Forms back to v0.63 while I looked into this users report.  The last thing I wanted to do was introduce a bug which resulted in corrupted posts.

I spent some time looking through my plugin code and tried a couple experiments but could not replicate the behavior the user reported.  My gut feel was we’re dealing with a plugin conflict however it is hard to know for sure.

The user and I ended up swapping some email and I got a list of plugins they were running.  I initially thought I would try and replicate their problem by installing the same set of plugins but quickly figured out that wasn’t possible.  Nor was it possible to examine all of the code for the plugins looking for what I suspected was a conflict in a “save_post” action or call to wp_update_post().

In doing some research I learned (unfortunately I can’t find it in the Codex) that beginning in WordPress 3.7 there is a new save_post action for Custom Post Types:  save_post_{$post_type}  Whoo-hoo!  This didn’t exist when I originally wrote Google Forms, so my plugin, much like many other plugins which define Custom Post Types, define a save_action which then has to determine if the post is relevant to the plugin or not before doing anything to it.

I quickly implemented the new action and removed the old action and Google Forms is behaving as it should in my testing.  I have uploaded this latest beta to my site and beat on it a bit and cannot corrupt any data.  I am very confident now that Google Forms should never touch anything other than it’s own post data.

Because of the reported corruption, I would encourage beta testers to backup their database before installing this update JUST TO BE SAFE but I think the corruption risk is very low.  Please let me know if you run into anything unusual.

In this v0.65 beta I have also changed the name of the plugin from “WordPress Google Form” to “Google Forms” as it is more representative and the plugin repository now prohibits the use of “WordPress” in a plugin name.  There is a chance you’ll have to reactivate the plugin depending on how you install this beta.

Google Forms Beta (579 downloads)

Google Forms v0.64 released

I did some additional testing with UTF-8 characters over the weekend and everything is working as expected.  With no known issues outstanding I have released v0.64 this morning.  You can find the update on your Dashboard or download it from the WordPress Plugin Repository.

  1. Fixed a number of strings which were missing translation wrapper functions.
  2. Reverted to manually constructed body parameter for wp_remote_post() to allow checkboxes to be properly passed to Google.
  3. Fixed warnings generated by calls to static functions which were not declared static.
  4. Added check for HTTP API cURL transport and issue a warning when not present. There was a change between WordPress 3.6.1 and 3.7 to the WordPress HTTP API and the streams and fsockopen transports are unable to post form values back to Google using wp_remote_post().
  5. Added a setting to allow hiding the cURL transport missing message on the Dashboard.
  6. Added a check to ensure jQuery script isn’t output more than once.
  7. Remove hook into “the_content” to reduce potential conflicts with other plugins (e.g. WordPress SEO plugin by Yoast).
  8. Added placeholders for some of the form fields when defining a Form within the UI.

Google Forms v0.64-beta-7 available

This afternoon I released beta-7 of Google Forms v0.64.  I expect this to be the final beta release.  It contains a few minor fixes, most notably the warning from the cURL check regarding calling a non-static function statically.  Additionally, some new “placeholder” information has been added to the Form Definition form which disappears when the user starts entering text into the field.

Google Forms Beta (579 downloads)

Google Forms v0.64-beta-6 available

I have just released beta-6 of Google Forms v0.64 which is a CRITICAL update for anyone who loaded beta-5.  Beta-5 had a serious bug which if you had defined more than one form using the Dashboard UI, would corrupt the content of all of the saved forms so every form would display the same content.  Beta-6 fixes this issue!

Google Forms Beta (579 downloads)

Google Forms v0.64-beta-5 available

2/14/2014 Update:  If you have more than one form defined, do not use beta-5, there is a serious bug which corrupts the content of the defined forms so they all contain the same data.

Beta #5 of Google Forms v0.64 is now available for testing.  This update addresses a plugin conflict between Google Forms and WordPress SEO plugin by Yoast.  The new implementation removes the hook into the_content which is a much more robust solution.

Google Forms Beta (579 downloads)

Google Forms v0.64-beta-3 available

This evening I uploaded v0.64-beta-3 of Google Forms.  This version adds a check for the WordPress HTTP API cURL transport and issue a notification if it isn’t present.

There was a substantial change to the WordPress HTTP API between 3.6.1 and 3.7.  I don’t know the full details of the change but what I found in pretty extensive testing is the streams and fsockopen transports work in 3.6.1 with the Google Forms plugin but from 3.7 and later, they do not.

However, the cURL transport does work and as long as it is available, the plugin will work as it always has.  The problem is I cannot find any way to work with sites that don’t have the cURL transport available so I have added this check and issue a notice when it isn’t present.

GForm_SS_70

 

Please download and test out this beta version and report any issues found.

Google Forms Beta (579 downloads)

Chasing Checkbox Support

For the past couple of days I have continued to look at the problem I wrote about with Google Forms and Checkboxes with PHP 5.4 and PHP 5.5.  It turns out, that it really isn’t PHP version related, at least I don’t think so.  It is WordPress related as near as I can tell.

As I’ve written before, I love VMware Workstation as it allows you to create virtual machines for very specific purposes, use them as long as needed, then put them away until needed again.

I created an Unbuntu VM to play with Ruby on Rails a couple months ago so I decided to check what version of PHP it had running.  Lo and behold, it had PHP 5.5.x running so it was a good platform to further test potential solutions for my checkbox problem.  My Windows environment is running PHP 5.3.3 and is still running WordPress 3.6.1 (don’t ask why but it proved to be very useful that it was).

I quickly set up WordPress 3.8 on Ubuntu and sure enough, submitting the form failed.  The exact same plugin code on my Windows VM submitted correctly.  I continued to dig through my code and eventually into WordPress itself trying to see what was different.

I eventually started looking at the source to wp_remote_post() and decided to identify which transport was being used.  On Windows WordPress was using cURL but on Ubuntu it was using Streams.  Ah-ha.  Since the WordPress HTTP API abstracts the details of the transports away from the application, it shouldn’t matter but it seems to.  I continued digging.

Using an advanced feature of WordPress Google Form to control transports, I disabled the cURL transport on the Windows machine and much to my surprise, the form still submitted correctly.  Now this is odd.  So I then installed cURL on Ubuntu and the form submitted correctly.  The good news is there at least appears to be a solution although I’d prefer to not have cURL be a requirement.

Now what was different?  I started looking into WordPress’ class-http.php file (which defines the WP_Http class) and noticed that the file on Windows was very different than the file on Ubuntu.  Looks like something changed between 3.6.1 and 3.8.1.

I decided to download the 3.6.1 and 3.7.1 releases from the WordPress archive and do some tests on Ubuntu where it is trivial to switch between WordPress releases.

To add a little more information, I did some testing with older versions of WordPress in combination with the http_api_transports to force a specific transport (‘streams’, ‘fsockopen’, and ‘curl’).  I found the following results:

WordPress 3.6.1 WordPress 3.7.1 WordPress 3.8.1
cURL Success Success Success
fsockopen Success Fail Fail
streams Success Fail Fail

Something clearly changed with the streams and fsockopen transports between 3.6.1 and 3.7.1.  A diff of the class-http.php file shows the change was substantial as the files are significantly different.

At this point I have concluded that my plugin will only work with sites where cURL is available.  I will probably release a version which displays a warning on the Dashboard if cURL is not available and that usage of the plugin is not recommended.