Google Moves Downgrade Option – Again

Google has made another change to the new version of Google Forms and moved the option to downgrade a form to the older version.  There is no longer a Running Man icon to click on to get the downgrade option.  Instead, look for the large question mark in the lower right hand corner .

2016-11-11_8-44-09

  1. Click on the Question Mark icon
  2. Click on the “Back to old Form” menu

This is the third time access to the downgrade option has moved.  It is probably just a matter of time before Google eliminates this completely.  If/when that happens it may no longer be possible to use Google Forms with WordPress.

Google moves Form Downgrade Option

Google has moved the “Running Man” icon which I had been recommending to downgrade a new Google Form to the prior version required by the Google Forms plugin.  Initially it looked like Google had removed the option which I was worried about.  The option to downgrade a form is now in the lower right hand corner for the form editor under the question mark (?) icon.

2016-05-22_13-30-02

Opting out of new Google Forms

As I noted in a post last week, Google has a new version of Forms on the horizon and it doesn’t currently work with the Google Forms plugin.

For the time being, it looks like Google has provided the ability to opt out of the new version of Google Forms which means you can still create forms which work with the Google Forms plugin.

2015-11-23_13-55-12

When creating a new form, look for the small running man icon in the lower left corner of the form editor as shown below.

2015-11-23_13-49-56

Clicking on this icon will revert the form the older version which works with the Google Forms plugin.

I still plan to look at supporting the new version as questions have already started to come in. I am just not sure when I will have a solution IF I can.

Understanding Email Users Options

Periodically I get support questions (on the WordPress Support forum) or comments here on my web site asking why Email Users doesn’t send email to some or all users as the plugin user expects it to.

Sometimes a user is dealing with an odd server restriction (e.g. email limits per hour, too many email addresses in the BCC field and others) but more frequently the target recipients don’t have their Email Users permissions set correctly.  This most frequently happens on a site where Email Users is added to a site that  already has a large set of users.

Email Users employs two options settings at the user level.  No matter what the settings are, any user within WordPress can always sent an email IF they are the only recipient.  This is by design.

The two settings are:

  • Allow Mass Emails:  Mass emails means that the user will accept email (Dashboard > Emails Users > Send to Users or Dasboard > Email Users > Send to Groups) where the resulting recipient list has more than one (1) recipient.  For a user in the WordPress database to receive email this permission must be enabled.
  • Allow Notifications:  Email Users has the ability to generate a notification email from a Post or Page (custom post types as well).  When using post or page notifications, only those users who have Notifications enabled will receive it.

Email Users has a default setting for these values which the WordPress admin can control.  It is on the plugin settings page (Dashboard > Settings > Email Users).

Email-Users-User-Options-1

These settings apply to all new users and when the plugin is activated the first time, are applied to all existing users.  The third option allows users to change their own settings by visiting their profile page.  When this option is enabled and a user visits their profile page, the following options are available for the user to change.

Email-Users-User-Options-2

 

The easiest way for the site administrator to review and change users’ settings, particularly on a site which has a lot of users, is to visit the User Settings Page (Dashboard > Email Users > User Settings).  This page will present all of the users (the number of users per page is set on the plugin settings page – see the image above for User Settings Table Rows) and their current settings.  The ability to perform bulk actions on a group of users is offered on this page.

Email-Users-User-Options-3

 

So if your users aren’t receiving emails, check their settings before heading down the debug path, often the solution is as simply as turning on the Mass Email option for the various users.

Google Forms Date and Time Fields

At some point Google added support for Date and Time fields to Google Forms.  When building the form, the Question Type now includes the “Date” and “Time” options.  These are pretty handy options because requesting dates and times from users is a very typical requirement.

GForm_SS_83Earlier this week a user posted on the WordPress Support Forum asking why their date field didn’t look the same on their web site using the plugin as it did when looking at the form within Google Drive.  The user assumed the plugin was doing something to change the form inputs.

The Google Forms plugin does not add or remove input fields (except the optional CAPTCHA field) – it simply retrieves the HTML from Google, strips of the content which falls outside of the form itself, and renders it within the WordPress context.

So why would the input fields be different when the form is viewed within WordPress versus viewing the Google Drive version of the form?

GForm_SS_85

Google Form in WordPress

GForm_SS_84

Native Google Form viewed in Firefox

Native Google Form viewed in Chrome.

Native Google Form viewed in Chrome.

As seen in the images above, the native Google Form is rendered differently in Google Chrome than it is in Firefox.  Having done some work with jQuery Mobile I know that Chrome recognizes HTML5 input tags where as Firefox does not.  I suspected this was the source of the problem.

I ran a couple of tests playing with cURL commands and different user agent strings and sure enough, Google is returning different HTML for different user agent strings.  I quickly added the user agent string to the parameters I was passing to the HTTP API to retrieve the HTML from Google and sure enough, the form, when viewed in Chrome, now matches what is seen when viewing the native form.

GForm_SS_87

I have committed the change to the plugin to pass the user-agent through the HTTP API.  This change will allow Chrome users to see the forms as intended.

What about other browsers?  Unfortunately the trick Google uses to add the date picker to the forms when viewed in Firefox, IE, or others which don’t recognize HTML5 input, or that Google thinks don’t support HTML5 input, isn’t easily passed through the HTTP API.

For now, I don’t see any simple way to solve this problem.  Over time it should go away as more browsers support HTML5 input types but for now, it is a limitation for non-Chrome users.  I fully expected it to work on the iPhone as the iOS browser is fully HTML5 compliant for input but it too is sent separate select inputs for the various fields.  I am not sure why, but it appears Google is treating their own browser differently than all other browsers.

The user-agent addition will be added to the next version of the plugin which will go out shortly with another validation bug fix.

 

 

Email Users with WP Better Emails

I recently worked with a user who reported Email Users wasn’t working correctly in conjunction with the WP Better Emails plugin.  The user posted a code sample he had used to correct the problem.

Looking at the code sample and his description of what WP Better Emails expected to receive as input, I added a new filter, mailusers_html_wrapper, that when present, would not add the default HTML wrapper around the email content but instead would expect the filter to perform the desired operation.  This new filter was released in the 4.7.2 version of Email Users.  There is an example usage of the new filter in my post announcing Email Users 4.7.2.

Shortly after releasing 4.7.2 I was contacted by the user again letting me know the filter didn’t solve the problem.  Confused, I download WP Better Emails to try and figure out what could possibly be wrong.  It took me the better part of two hours to trace through the WPBE code and figure out what it is doing – it turns out, WPBE wants emails to be “plain text” and not HTML formatted.  This is counter intuitive and had me looking in the wrong place for quite while.  It seems backwards to me but that is how the WPBE plugin works.

So how to make WPBE work with Email Users?  It turns out, it isn’t that hard at all.  There is a WordPress filter, wp_mail_content_type, which influences wp_mail(), the function WordPress uses to send email.

If a wp_mail_content_type filter is defined to force the content type to “text/plain”, Email Users and WPBE will work together correctly.  Below is the filter I defined and tested the interaction of Email Users and WPBE with.  Place this filter in your theme’s functions.php file or somewhere else where it will be loaded.

add_filter( 'wp_mail_content_type', 'mailusers_set_content_type' );
function mailusers_set_content_type( $content_type ) {
return 'text/plain';
}

Google Forms Custom Confirmation

I tend to get a lot of question regarding how to implement a custom confirmation page with the Google Forms plugin.  This morning I wrote up a step by step process which walks through all of the steps I use to define a confirmation page and make the process as smooth as possible for the end user.

When do you Start over?

About a month ago I posted that I had started on a Ruby on Rails project.  It was my first RoR project and I spent a couple weeks working on it, learning as I went.  One of the things I had deferred working on was User registration.  I had some done some reading and it looked like there were several viable Gems I could integrate fairly easily.

I have gotten into the habbit of taking my iPad to the gym in the morning and reading up on whatever project I am noodling on.  So I’ve done a lot of RoR reading while on the elliptical machine and came to the conclusion that AuthLogic would suit my rather simple needs.  So I kept working on the functionality I needed for the App, deferring User management for a later day.

I had to put my RoR project aside for 3-4 weeks while working on a Tcl based project for work but got back to it over the weekend.  I decided it was time to tackle the User login module.  Initially everything seemed to be ok, I could follow the examples and make things work but I kept running into little issues and I never got it to work reliably.  The lack of Rails 4 examples to use as a reference got me thinking (and concerned).  Maybe I should have picked Devise (the other Gem which seems pretty popular).

I created a simple RoR App solely to test Devise and it will very simple to setup and configure.  Great, let me fold it into the App I am working on.  Uh-oh.  Not so easy.  I am not sure if it was because Authlogic also defines a User model and there were some leftover pieces of it that were confusing Devise or it was something else in my App but after a couple hours of playing with it, I concluded what I was trying to do was a fool’s errand.

This got me thinking – was it time to start over?  Should I consider all of the work I’ve done to date a “learning experience”?  The more I thought about it the more I knew starting again was the right answer.  But I had so much other functionality already working I hated to throw it away.  Decisions, decisions.

In the end I decided to start over and being with the Devise user module.   I decided to make use of the Rails-Devise example application as a starting point as it will walk through a configuration processs where by answering questions it will generate the basis for a Rails App.  It is pretty slick.  I ran it a couple times to understand the impact of some of the choices but settled on a final configuration which has become my starting point.

I was very quickly able to add some of the functionality I had worked out previously so as painful as it was, I am pretty sure that starting over was the right answer in this situation.  Granted my problem was much smaller in scope than many projects and more importantly, it hadn’t been deployed yet so other than a release delay, my decision has not impacted the end user at all.  That isn’t always the case.

Buying a SIM Card in Germany was harder than it SHould Be

A while ago I gave up my AT&T unlimited international data plan (you did what?) to move my family to a Mobile Share plan.  We have 8 phones on a 10GB Mobile Share plan and have only exceeded our limit once so objectively it was the right decision for us.  Having a Verizon MiFi from work certainly helps although it does mean that I need to actually think when I travel internationally.

I am in Munich this week for work and even though work will pay for the international add-on I have to turn on now when I travel out of the US, I decided I would buy a prepaid SIM card for data and put it in an unlocked Moto G which I have (having an unlocked phone comes in handy from time to time) and see if it would be a viable alternative to the $50 I paid AT&T for 500M of international data.

When I went to Poland a couple months ago I connected via Heathrow and picking up a SIM card was trivial.  You put your credit card in a vending machine, picked the SIM plan you wanted and and it was dropped out like a candy bar.  Simple.  Two minute transaction, if that.

I expected the same in Germany if not even easier, because if there is one thing Germany is good at, it is automating processes.  My experience was pretty much the opposite.  Not a SIM card vending machine in site at the Munich airport.  No big deal, there are several stores that appear to be selling them so I stopped in one.  The person in front of me wanted two SIM cards for their iPhones.  I waited at least 10 minutes before I gave up to go meet some co-workers and the cashier hadn’t   even gotten one working.  Odd.

I ventured out from my hotel having seen a number of stores in the general vicinity – Vodafone, O2, T-Mobile, and several independent stores.  I thought I was looking for something relatively simple.  I was looking for 1GB of data for about 20 Euros, less would be better.  It seemed that every store I went into had a different story.  From two different T-Mobile stores I got different answers.  At one I was told 10 Euros for 500MB but I couldn’t add to it if I went over.  At another store I was told that I could get 200MB per day for 10Euros up to 1GB during a week and  it would cut off after 200MB until the next day.  Odd.

Other vendors had variations of similar things.  I settled on an O2 card of 1GB which was good for a week.  Great, sound just like what I am looking for.  I’ll take it. Give  the clerk my Visa card – uh-oh, only cash for pre-paid SIM cards.  WTF?  I usually have some Euros with me but not an hour earlier I had dropped about 60 Euros for lunch for myself and three co-workers because the restaurant didn’t take credit cards.  That would have been helpful to know before we ate!

So out I go in quest of Euros from an ATM.  While I was out getting Euros I realized the cashier at the cell phone shop still had my passport!  Major panic.  If there is one thing that I worry about traveling it is losing my passport.  I have copies of it but I really don’t want to have to go through that experience.  Fortunately the cashier realized it as soon as I left the shop and put it in a safe place.  Yikes!  Back to find Euros.  For whatever reason the only credit card I can get Euros with is my PayPal debit card. 

So now I have  Euros to pay for the SIM card and this whole experiment is taking way longer than it should but with this much time invested, I press on.  Besides, I need something to keep me occupied until I meet up with my co-workers later this evening.  I need to stay away from the hotel room where it would be too easy to take a nap and be out of sync time wise all week.

As the cashier, a young guy – maybe 20 years old, is completing my transaction three young women come into the shop asking for unlimited Internet SIM cards in English.  After conversing with them in English for a bit he asks if they are Russian and switches to speaking Russian.  At that point his attention is on them and he fails to give me a critical piece of information with my SIM card packet.  The registration number.

I leave the store ready to try my experiment.  The instructions are in German, which I don’t speak but how hard can it be?  It is a SIM card and it has been paid for.  Put it in the phone and it should work.  Right?

Nope.  I have the SIM installed and the phone asks for a SIM activation pin code which is on the package and I enter.  So far so good.  Can I browse the web?  Nope.  An O2 web site comes up, in German of course, which I am clueless as what to do with.  It wants some sort of registration number.  Great.  After futzing around with it for 10 minutes I head back to the O2 store, which fortunately is next door to the hotel, I go back for the third time.

The woman helping me this time asks if I registered it?  No, how would I know what to do or how?  She pulls a scratch card out of the package which apparently my original clerk should have alerted me to and probably would have had he not been distracted by the Russian girls.  10 minutes later I am online and headed back to my hotel.  Oh yeah, one other little caveat.  Prepaid plans only support 3G.  No LTE and no HSUPA.  Bummer.

So in the end was it worth it?  I don’t know.  It was a good learning experience and it kept me busy for a couple hours.  I know a lot more should I or someone in my family, ever need to do this again.  I’ll play with it some more over the course of the week but in summary, it is waaaaaaay harder than it should be and quite a bit harder than in the UK.

Email-Users Debugging – why don’t my users receive email?

Periodically users post questions in the Email-Users support forum wondering why their users don’t receive email messages when they expect them to.  There are many reasons why users don’t receive email, some are within the control of Email-Users but many are not.

Email-Users User Settings

Email-Users is based on two user settings (which appear on the user’s profile page):

  1. Receive post or page notification emails
  2. Receive emails sent to multiple recipients

EU_SS_14Email-Users has a plugin level setting which allows end users to modify their own settings which is enabled by default.  When it is disabled, only users with the proper permissions can modify user settings related to Email-Users.  No matter how the user has their settings configured, a user can always receive an email when they are the only recipient.

EU_SS_15In Email-Users v4.5.2 a new Dashboard Widget has been added which reports the number of users who have their settings configured to receive each type of email.  This information also appears on the Plugin Settings Page and should either of the types of email not have any users set to receive email, a warning message is displayed at the top of the screen.

EU_SS_17Changing the Email-Users settings for a large number of users can be accomplished from the User Setting menu.  By selecting the desired Users, Notifications and Mass Email can be enabled or disabled for a large number of users at one time.  For a site that has a large number of users, the number of users which appear on each page can be changed on the Settings Page.

Test Email

Before sending out notifications or messages, it is important to validate the underlying WordPress email system is working.  On the Plugin Settings page there is the ability to send a Test Message.

EU_SS_18

Email-Users utilizes WordPress’ wp_mail() function to send email.  It does not interact with the OS or PHP mail functions directly.  By using wp_mail(), which can be overridden by other WordPress plugins, Email-Users can work with different server configurations and email infrastructure.

If you don’t receive the test message then you may have a problem with your underlying WordPress email system.  Do you receive email for user registration and comments?  If not, there is something wrong which is out of the scope of Email-Users.

On some servers plugins such as WP-Mail-SMTP (this is just an example, there are others) can be used in situations where email is being sent but isn’t being received.

There is no point in trying to send Notifications or Mass Emails if the Test Message isn’t working.

BCC Limits

Some servers limit the number of email addresses which can appear in the BCC header of an email message.  Email-Users has a setting to control the number of addresses which appear in the BCC field.  If Email-Users is working for a small number of users but isn’t working for a larger number (e.g. all of your users) , you may be dealing with a BCC limit.

If you are able to send email to 3-5 users by selecting them from the list of users, I would next try sending a message to about 10 users and see if that works.

The sending logic is only different when 1 user is selected. Anytime more than one user is selected (2, 10, 37, 67, 1000, etc.), the same logic path through the code is used.

The only thing that is different is how many emails are sent and that is based on the BCC limit setting. If there is no limit, which is the default, it sends one email with all recipients on the BCC line. For any other setting, it will send some number of emails, depending on the BCC limit. If the BCC limit was set to 30 and you had 67 recipients, it would send 3 emails: The first 30, the second 30, and the final 7.

Advanced Debugging

In some situations you may want to examine what Email-Users is doing in gory detail.  For development purposes Email-Users has a DEBUG mode.  When in debug mode Email-Users will log quite a bit of information to the PHP error console using error_log() including the actual email headers it generates.  It can be very useful to see the actual mail headers to ensure the expected recipients are actually included.

Because gaining access to the contents of the error_log() differs from web host to web host, I recommend using a WordPress debugging capability to capture it in the site’s /wp-content folder.  By setting WP_DEBUG_LOG to true in your wp-config.php file, you can easily access the resulting debug.log file.  On my development machine I use the following set up in my wp-config.php file:

define('WP_DEBUG', true); // or false
if (WP_DEBUG) {
 define('WP_DEBUG_LOG', true);
 ini_set('display_errors', 'on');
 error_reporting(E_STRICT | E_ALL);
 define('SAVEQUERIES', true);
 define('SCRIPT_DEBUG', true);
 error_log('Debug On!') ;
}

You would not want this on a production server but to temporarily chase down a problem, it works well.  Unfortunately some plugins issue a lot of notices or warnings so you can run into the “Headers already sent” problem so you may want to tweak the above settings to meet your needs.

Once your WordPress debugging settings are tuned to your liking, you need to enable Debug for Email-Users.  Doing this requires manually editing one of the plugin files.

On or about line 46 of the email-users.php file you will find a line of code which reads:

define( ‘MAILUSERS_DEBUG’, false);

You need to change the code such that it reads:

define( ‘MAILUSERS_DEBUG’, true);

After you have made this change Email-Users will output information to the error_log.

In the image below you can see a series of email headers each with 10 email addresses in the BCC field (BCC limit is set to 10).

EU_SS_19

If the information in the error_log is what is expected then there is little, if anything which can be done from Email-Users.  At this point you will need to figure out where the email is routing to and where it isn’t which is beyond the scope of the Email-Users plugin.

Anecdote

I was using Email-Users on our local Swim Team’s web site and heard from a number of parents that they weren’t receiving emails.  I noticed that all of the reports were coming from families with RoadRunner email addresses.  It turned out that Time Warner had blacklisted our Swim Team’s domain.  By filling out a form with TWC and verifying some information, we were able to get white listed but for several weeks I wasn’t sure how to resolve it.