“Send as Email (If…)”

If you have not discovered John Godley’s collection of WordPress plug-ins…you owe me big. I use at least half of them. The most flexible of them all is “Filled-In” – an amazing piece of code that alone is worth three any other plug-ins. Don’t take my word for it – check it out!

I have little doubt that some day Filled-in will be as popular among power users as widgets are among amateur bloggers.

The real beauty of it is that this baby can be easily extended.

And so, when I finally run into something it could not readily do, I wrote the extension posted below. I am not very good at PHP, but if you check my two posts on John’s site, you will see that it took me about four hours to figure out what it takes and put together (and debug) a new, useful extension.

You can do it too!

Ok, enough propaganda. Here it comes.


“Send as Email (If…)” extension
for the “Filled-In” plug-in for WordPress

Assumption: you have installed the original Filled-In plug-in and understand what it does.

What does this extension do?

It’s just one more Post Processor. It takes the input of a form processed by Filled-In, and hands it over to an email template to be sent to whoever you want.

This functionality is already implemented in the standard “Send as Email” PostProcessor.

What’s new? This extension only sends the email if a user-defined condition is satisfied. (For those who care: the condition part came straight from the “Is Equal” filter.)

How is this different from using a pre-processor?

A pre-processor, if not satisfied, kills your input right there and then. Form’s input is marked as “failed” and does not see the light of day.

Send as Email (If…) gives you a tool for emailing your form contents to various addresses depending on the input.

If it is not satisfied… nothing happens. Hopefully, some otherPostProcessor (another instance of Send as Email I, perhaps) will handle the data. Or not – your choice, your problem. (The transaction is marked as successful either way.)

Why did I write it? – an example of a possible use

I have a “Contact Us” form (not in this blog) with a drop-down subject list.

I wanted to route visitor input regarding Web Site problems to myself, while the rest would go elsewhere. All I had to do is define two PostProcessors:

  1. one takes all forms where “Subject” field is “Website problems” (see the screen shot:Screen Shot )and emails the contents to me
  2. the other takes all forms where “Subject” filed is not “Website problems” (there is a clever “not” checkbox) and emails the contents elsewhere.

You can be even fancier and have multiple overlapping sets of recipients with multiple different email templates – I told you, Filled-In kicks ass!

Download and install “Send as Email (If…) “

  1. Download Send as Email (If…) – email_if.txt
  2. Rename email_if.txt into email_if.php
  3. Upload email_if.php into your wordpress/wp-contents/plugins/filled-in/extensions/post/ directory. “Send as Email(If…) will now appear among your Filled-In Post Processors.
  4. Come back here and tell me how it works out for you! – writing this up took quite some effort.
  5. Go sand say “Thank You” to John for the Filled-In plug-in.
  6. NOW you are done.


  1. Sorry, could you please point me to your Send as Email (If…) plugin? The link provided is not working.

    Thanks

    1. Sorry for belated reply – i just checked and the link works fine. (The file is hosted by wordpress.com). Try again? Mybe in a different browser? The file has a .txt extension to confuse some nosy “security tools”.

  2. When you happen to be at home and cooking, it really is very simple to
    leave the meals sitting out on the counter. Of course, this is the IDEAL temperature and there could possibly be reasons why you
    won`t have the ability to keep your stockpile this cool
    whatsoever times (high electric bills, blackouts).

    Total time from cooking to spoiling for any Facebook Cafe World bacon cheeseburger
    is 11 minutes. For some of us it will likely be smarter to
    move to your more survivable location, which people will have or will come up with bug
    out bags. content

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


About

I am sorry you have to see this. Actually, I am not – if you came here, it’s you fault. When we choose our actions we also choose the consequences.

Despite my oversized ego I do NOT believe that anyone out there craves a daily dose of my insight. In fact, I am suspicious of people who think otherwise.

This blog is a tool.

I meddle with many complex computer deployments, and as I go through adding features and learning things, I also tend to forget numerous details and the reasoning behind the many choices I have made in the past. This is the place to document my adventures. And to give something back.

If you stumble upon this and find it useful – …good for you.


%d bloggers like this: