<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Konstantin Kovshenin &#187; plugins</title>
	<atom:link href="http://kovshenin.com/tag/plugins/feed/" rel="self" type="application/rss+xml" />
	<link>http://kovshenin.com</link>
	<description>WordPress, Automattic and Open Source</description>
	<lastBuildDate>Mon, 21 May 2012 15:59:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Rewrite Rules Inspector</title>
		<link>http://kovshenin.com/2012/rewrite-rules-inspector/</link>
		<comments>http://kovshenin.com/2012/rewrite-rules-inspector/#comments</comments>
		<pubDate>Thu, 10 May 2012 06:21:10 +0000</pubDate>
		<dc:creator>Konstantin Kovshenin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[rewrite]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kovshenin.com/?p=5653</guid>
		<description><![CDATA[Clients often ask for fuzzy, non-standard, maybe weird and not always logical permalink structure for their sites. If you&#8217;re now working with such a client, consider yourself lucky, because the brand new Rewrite Rules Inspector plugin is here! Props to the WordPress.com VIP team :)]]></description>
			<content:encoded><![CDATA[<p><a href="http://kovshenin.com/files/2012/05/rewrite-rules-inspector.jpg"><img src="http://kovshenin.com/files/2012/05/rewrite-rules-inspector-680x220.jpg" alt="Rewrite Rules Inspector" title="Rewrite Rules Inspector" width="580" height="187" class="alignnone size-large wp-image-5659" /></a></p>
<p>Clients often ask for fuzzy, non-standard, maybe weird and not always logical <strong>permalink structure</strong> for their sites. If you&#8217;re now working with such a client, consider yourself lucky, because the brand new <a href="http://vip.wordpress.com/2012/05/09/new-plugin-rewrite-rules-inspector/">Rewrite Rules Inspector plugin is here</a>! Props to the WordPress.com VIP team :)</p>
]]></content:encoded>
			<wfw:commentRss>http://kovshenin.com/2012/rewrite-rules-inspector/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Jetpack 1.3 Released, now with Grunion Contact Forms</title>
		<link>http://kovshenin.com/2012/jetpack-1-3-released-now-with-grunion-contact-forms/</link>
		<comments>http://kovshenin.com/2012/jetpack-1-3-released-now-with-grunion-contact-forms/#comments</comments>
		<pubDate>Wed, 25 Apr 2012 06:26:36 +0000</pubDate>
		<dc:creator>Konstantin Kovshenin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[jetpack]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kovshenin.com/?p=5610</guid>
		<description><![CDATA[Jetpack 1.3 has been released, and it now ships with the Grunion Contact Forms plugin, the very same forms plugin that&#8217;s running (behind the scenes) on WordPress.com. The update fixes a couple of small bugs as well. You should be able to download it from your Dashboard very soon.]]></description>
			<content:encoded><![CDATA[<p><a href="http://kovshenin.com/files/2012/04/jetpack-contact-form.png"><img class="alignnone size-large wp-image-5612" title="Jetpack Contact Forms" src="http://kovshenin.com/files/2012/04/jetpack-contact-form-680x433.png" alt="Jetpack Contact Forms" width="580" height="369" /></a></p>
<p>Jetpack 1.3 <a href="http://jetpack.me/2012/04/24/jetpack-1-3-released-contact-forms/">has been released</a>, and it now ships with the Grunion Contact Forms plugin, the very same forms plugin that&#8217;s running (behind the scenes) on WordPress.com. The update fixes a couple of small bugs as well. You should be able to download it from your Dashboard very soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://kovshenin.com/2012/jetpack-1-3-released-now-with-grunion-contact-forms/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to write a terrible WordPress tutorial</title>
		<link>http://kovshenin.com/2012/how-to-write-a-terrible-wordpress-tutorial/</link>
		<comments>http://kovshenin.com/2012/how-to-write-a-terrible-wordpress-tutorial/#comments</comments>
		<pubDate>Wed, 11 Apr 2012 08:03:06 +0000</pubDate>
		<dc:creator>Konstantin Kovshenin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kovshenin.com/?p=5540</guid>
		<description><![CDATA[How to write a terrible WordPress tutorial: &#8220;Do X without a plugin. Just paste Y into your functions.php!&#8221; &#8212; Evan Solomon (@evansolomon) April 11, 2012 True, and here&#8217;s a related post I wrote earlier about Plugins vs. Without a Plugin. Still, we keep seeing such tutorials piling up everyday, even obvious ones like Google Analytics. [...]]]></description>
			<content:encoded><![CDATA[<blockquote class="twitter-tweet" width="550"><p>How to write a terrible WordPress tutorial: &#8220;Do X without a plugin. Just paste Y into your functions.php!&#8221;</p>
<p>&mdash; Evan Solomon (@evansolomon) <a href="https://twitter.com/evansolomon/status/189909728145571841" data-datetime="2012-04-11T02:56:22+00:00">April 11, 2012</a></p></blockquote>
<p><script src="//platform.twitter.com/widgets.js" charset="utf-8"></script></p>
<p>True, and here&#8217;s a related post I wrote earlier about <a href="http://kovshenin.com/2012/plugins-vs-without-a-plugin/">Plugins vs. Without a Plugin</a>. Still, we keep seeing such tutorials piling up everyday, even obvious ones like Google Analytics.</p>
<p>Why would one want to go through the trouble of copying and pasting code into their theme&#8217;s header.php file, and then breaking everything when they change their theme or when the theme gets an update? Why not just use a plugin that will retrieve the analytics profile via OAuth?</p>
<p>Is it considered &#8220;cool&#8221; to copy/paste all my plugins into my theme&#8217;s functions.php file? If so, I might just try it out right here on my site! And since I&#8217;m running multisite with quite a few different sites, I&#8217;ll have to do that ten times for each plugin that I need to use. Then maybe use constants to indicate which snippets I want active and which ones I don&#8217;t. *</p>
<p>And as soon as I end up with a 5000-line functions.php file, I can go complain that WordPress is too difficult to learn, and that it&#8217;s a pain switching themes or domains, and maybe blame Otto for absolute URLs too. *</p>
<p><small>* Sarcasm</small></p>
]]></content:encoded>
			<wfw:commentRss>http://kovshenin.com/2012/how-to-write-a-terrible-wordpress-tutorial/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Inbound Marketing Plugin for WordPress</title>
		<link>http://kovshenin.com/2012/inbound-marketing-plugin-for-wordpress/</link>
		<comments>http://kovshenin.com/2012/inbound-marketing-plugin-for-wordpress/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 15:00:39 +0000</pubDate>
		<dc:creator>Konstantin Kovshenin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kovshenin.com/?p=5534</guid>
		<description><![CDATA[Considering doing a new WP plugin. I&#8217;d call it &#8220;inbound marketing for WordPress&#8221;, does the same as my SEO plugin, but paid :-P &#8212; Joost de Valk (@yoast) April 9, 2012]]></description>
			<content:encoded><![CDATA[<blockquote class="twitter-tweet" width="550"><p>Considering doing a new WP plugin. I&#8217;d call it &#8220;inbound marketing for WordPress&#8221;, does the same as my SEO plugin, but paid :-P</p>
<p>&mdash; Joost de Valk (@yoast) <a href="https://twitter.com/yoast/status/189302559159222272" data-datetime="2012-04-09T10:43:41+00:00">April 9, 2012</a></p></blockquote>
<p><script src="//platform.twitter.com/widgets.js" charset="utf-8"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://kovshenin.com/2012/inbound-marketing-plugin-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The MIT license is compatible with the GPL</title>
		<link>http://kovshenin.com/2012/the-mit-license-is-compatible-with-the-gpl/</link>
		<comments>http://kovshenin.com/2012/the-mit-license-is-compatible-with-the-gpl/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 07:14:06 +0000</pubDate>
		<dc:creator>Konstantin Kovshenin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gpl]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kovshenin.com/?p=5515</guid>
		<description><![CDATA[The MIT license is compatible with the GPL and can be used when submitting plugins to the WordPress.org directory. Thanks to Mark Jaquith for clearing that up.]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://en.wikipedia.org/wiki/MIT_License">MIT license</a> is compatible with the <a href="http://en.wikipedia.org/wiki/GNU_General_Public_License">GPL</a> and can be used when submitting plugins to the WordPress.org directory. Thanks to Mark Jaquith for <a href="https://twitter.com/#!/markjaquith/status/188108457386311681">clearing that up</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://kovshenin.com/2012/the-mit-license-is-compatible-with-the-gpl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to: Disable Jetpack Subscriptions Notifications</title>
		<link>http://kovshenin.com/2012/how-to-disable-jetpack-subscriptions-notifications/</link>
		<comments>http://kovshenin.com/2012/how-to-disable-jetpack-subscriptions-notifications/#comments</comments>
		<pubDate>Mon, 19 Mar 2012 13:23:37 +0000</pubDate>
		<dc:creator>Konstantin Kovshenin</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[jetpack]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://kovshenin.com/?p=5307</guid>
		<description><![CDATA[It&#8217;s more difficult to keep this in mind, than it is to actually execute it. Sometimes we (content creators) want to publish content to see how it feeds to our Twitter or Facebook accounts, or to see how it turns up in the RSS feed, so what we usually do is publish a &#8220;test&#8221; post [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s more difficult to keep this in mind, than it is to actually execute it. Sometimes we (content creators) want to publish content to see how it feeds to our Twitter or Facebook accounts, or to see how it turns up in the RSS feed, so what we usually do is publish a &#8220;test&#8221; post and delete it afterwards (together with the tweet and Facebook post.)</p>
<p>However, sent e-mails cannot be deleted, once they&#8217;re out there, there&#8217;s no turning back. It&#8217;s not the best user experience to receive a &#8220;testing my twitter plugin&#8221; e-mail, right? <a href="http://jetpack.me/">Jetpack</a> is one of the best ways to deliver e-mail notifications, about your new posts, to your subscribers. I <a href="http://kovshenin.com/2012/using-jetpack-for-e-mail-subscriptions-in-wordpress/">wrote</a> about it before and actually <a href="http://kovshenin.com/subscribe/">use it</a> myself.</p>
<p>The best way to prevent all of this is of course to use dummy accounts or staging servers. The second best way to test your posts publishing out, is to wait for actual content (and if things didn&#8217;t work, try again next time), but sometimes we want to just try it out in our live environment, and if you do that, don&#8217;t forget to disable Jetpack subscriptions, which can be done in two easy steps. In the Jetpack configuration page under Subscriptions, hit <strong>Learn More</strong> and you&#8217;ll see a <strong>Deactivate</strong> button.</p>
<p><a href="http://kovshenin.com/files/2012/03/disable-jetpack-subscriptions.png"><img class="alignnone size-large wp-image-5308" title="Disable Jetpack Subscriptions" src="http://kovshenin.com/files/2012/03/disable-jetpack-subscriptions-680x197.png" alt="Disable Jetpack Subscriptions" width="580" height="168" /></a></p>
<p>Don&#8217;t worry, you will not loose all your subscribers, they&#8217;ll start receiving notification e-mails, when you <strong>Activate</strong> the subscriptions module again on that very same page, and yeah, don&#8217;t forget to activate it back when you&#8217;re done &#8220;testing things out.&#8221;</p>
<p>That&#8217;s about it! How do you handle test posts you don&#8217;t want your subscribers to see? Can you easily deactivate the e-mails with other plugins and services such as Feedburner? Share your thoughts and comments and thank you for <a href="http://kovshenin.com/subscribe/">subscribing</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://kovshenin.com/2012/how-to-disable-jetpack-subscriptions-notifications/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>All in One SEO Pack for WordPress Downloaded 10,000,000 Times!</title>
		<link>http://kovshenin.com/2012/all-in-one-seo-pack-for-wordpress-milestone/</link>
		<comments>http://kovshenin.com/2012/all-in-one-seo-pack-for-wordpress-milestone/#comments</comments>
		<pubDate>Mon, 27 Feb 2012 16:41:44 +0000</pubDate>
		<dc:creator>Konstantin Kovshenin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kovshenin.com/?p=5158</guid>
		<description><![CDATA[Wow! Congratulations @michaeltorbert! All in One SEO Pack for #WordPress reaches 10,000,000 downloads wordpress.org/extend/plugins… &#8212; Konstantin Kovshenin (@kovshenin) February 27, 2012]]></description>
			<content:encoded><![CDATA[<blockquote class="twitter-tweet" width="550"><p>Wow! Congratulations @<a href="https://twitter.com/michaeltorbert">michaeltorbert</a>! All in One SEO Pack for <a href="https://twitter.com/search/%2523WordPress">#WordPress</a> reaches 10,000,000 downloads <a href="http://t.co/4ee3oNZ5" title="http://wordpress.org/extend/plugins/all-in-one-seo-pack/">wordpress.org/extend/plugins…</a></p>
<p>&mdash; Konstantin Kovshenin (@kovshenin) <a href="https://twitter.com/kovshenin/status/174162128377364480" data-datetime="2012-02-27T16:01:01+00:00">February 27, 2012</a></p></blockquote>
<p><script src="//platform.twitter.com/widgets.js" charset="utf-8"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://kovshenin.com/2012/all-in-one-seo-pack-for-wordpress-milestone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An Actual Retweet Button for Jetpack &amp; Sharedaddy</title>
		<link>http://kovshenin.com/2012/an-actual-retweet-button-for-jetpack-sharedaddy/</link>
		<comments>http://kovshenin.com/2012/an-actual-retweet-button-for-jetpack-sharedaddy/#comments</comments>
		<pubDate>Sun, 26 Feb 2012 13:44:03 +0000</pubDate>
		<dc:creator>Konstantin Kovshenin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[jetpack]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[social media]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://kovshenin.com/?p=5119</guid>
		<description><![CDATA[I was thinking about this for quite some time now &#8212; an actual retweet button for WordPress, and I wonder why Twitter hasn&#8217;t provided one yet, it&#8217;s so obvious! Yes, the tweet button is doing a great job these days, but let&#8217;s admit, that we content publishers enjoy retweets more than regular tweets to our [...]]]></description>
			<content:encoded><![CDATA[<p>I was thinking about this for quite some time now &#8212; an <strong>actual retweet button</strong> for WordPress, and I wonder why Twitter hasn&#8217;t provided one yet, it&#8217;s so obvious!</p>
<p><img title="Sharedaddy Retweet Button" src="http://kovshenin.com/files/2012/02/sharedaddy-retweet.png" alt="Sharedaddy Retweet Button" width="666" height="247" /></p>
<p>Yes, the <a href="https://twitter.com/about/resources/buttons#tweet">tweet button</a> is doing a great job these days, but let&#8217;s admit, that we content publishers enjoy <a href="https://support.twitter.com/articles/77606">retweets</a> more than regular tweets to our articles, because:</p>
<ul>
<li>They show your name and your Twitter avatar along with the original message, so when others see your tweet retweeted, there&#8217;s a better chance they&#8217;ll follow you.</li>
<li>They instantly show up in your Interactions and increase the retweet count, so you can always see who&#8217;s tweeting your posts, without having to use Twitter&#8217;s search.</li>
<li>They give you a better chance to get a <a href="https://support.twitter.com/articles/131209-what-are-top-tweets">Top Tweet</a>, thus providing even more exposure.</li>
</ul>
<p><span id="more-5119"></span></p>
<p>With the use of <a href="https://dev.twitter.com/docs/intents">Twitter&#8217;s Web Intents</a> I was able to create a small extension for <a href="http://wordpress.org/extend/plugins/sharedaddy/">Sharedaddy</a> (bundled with <a href="http://jetpack.me">Jetpack</a>.) It allows the use of a retweet button as one of the sharing options.</p>
<p>It currently fetches the post meta for a <strong>retweet-id</strong> key which has to be the id number of the original tweet on Twitter. You can use the Custom Fields interface to enter the retweet-id value, but will probably wrap this up in a meta box, where one could just give the URL of the tweet.</p>
<p><img class="alignnone size-full wp-image-5130" title="Retweet ID in Custom Fields" src="http://kovshenin.com/files/2012/02/custom-fields-retweet-id.png" alt="Retweet ID in Custom Fields" width="640" height="167" /></p>
<p>As soon as there&#8217;s a retweet ID associated with a post or page, the retweet button will show up, and when clicked, it will popup a web intent with the option to retweet.</p>
<p><img class="alignnone size-full wp-image-5131" title="Retweet Intent" src="http://kovshenin.com/files/2012/02/retweet-intent.png" alt="Retweet Intent" width="545" height="184" /></p>
<p>However, if a retweet ID has not been supplied, the retweet button will fall back to the original tweet button shipped with Sharedaddy, so make sure you don&#8217;t use the two together :)</p>
<h2>Download</h2>
<p>The plugin is still very rough and I thought I&#8217;d give it a test drive here on my blog, before sending it out to the public plugins directory. Obviously there probably are some bugs, cross-browser issues and css overhead. You can follow the plugin <a href="https://github.com/kovshenin/sharedaddy-retweet">project on Github</a> and make sure you have activated Jetpack or Sharedaddy before using the plugin.</p>
<p>Thanks for stopping by, and feel free to share your thoughts and comments. Let me know if you&#8217;d like to contribute to the plugin, so I can give you push access on Github. I appreciate retweets too!</p>
]]></content:encoded>
			<wfw:commentRss>http://kovshenin.com/2012/an-actual-retweet-button-for-jetpack-sharedaddy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Jetpack for E-mail Subscriptions in WordPress</title>
		<link>http://kovshenin.com/2012/using-jetpack-for-e-mail-subscriptions-in-wordpress/</link>
		<comments>http://kovshenin.com/2012/using-jetpack-for-e-mail-subscriptions-in-wordpress/#comments</comments>
		<pubDate>Fri, 24 Feb 2012 14:49:59 +0000</pubDate>
		<dc:creator>Konstantin Kovshenin</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[jetpack]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://kovshenin.com/?p=3815</guid>
		<description><![CDATA[You can find a bunch of &#8220;subscribe to posts&#8221; plugins in the WordPress.org directory but from my personal experience, it&#8217;s very difficult to find something as good and reliable as Jetpack. The major difference is behind the scenes &#8212; when most post subscription plugins will use the wp_mail function to distribute your new post (using sendmail from [...]]]></description>
			<content:encoded><![CDATA[<p>You can find a bunch of &#8220;subscribe to posts&#8221; plugins in the <a href="http://wordpress.org/extend/plugins/">WordPress.org directory</a> but from my personal experience, it&#8217;s very difficult to find something as good and reliable as <a href="http://jetpack.me/">Jetpack</a>.</p>
<p><img class="alignnone size-large wp-image-3817" src="http://kovshenin.com/files/2012/02/jetpack-subscriptions-680x189.png" alt="Jetpack E-mail Subscriptions for WordPress" width="580" height="161" /></p>
<p>The major difference is behind the scenes &#8212; when most post subscription plugins will use the <a href="http://codex.wordpress.org/Function_Reference/wp_mail">wp_mail</a> function to distribute your new post (using sendmail from your server or an SMTP account,) Jetpack will simply send your new post to the WordPress.com server, which will take care of the distribution for you.</p>
<p><span id="more-3815"></span></p>
<p>Why does that matter? I can name several reasons:</p>
<ul>
<li><span style="line-height: 21px">The WordPress.com mail servers can handle far more load than your shared hosting server, VPS or dedicated server, so e-mails will (most likely) be delivered on time and to everyone.</span></li>
<li><span style="line-height: 21px">People enjoy reading posts from one place. RSS feeds is a good option, but so is the <a href="http://wordpress.com/read/">WordPress.com Read</a> module.</span></li>
<li><span style="line-height: 21px">People can manage their WordPress.com and Jetpack-powered subscriptions in one place, choose between immediate e-mails, daily digests and IM notifications, as well as choose between HTML and plain text e-mails.</span></li>
<li><span style="line-height: 21px">You can use Stats in Jetpack to track your blog followers.</span></li>
</ul>
<p>However, there are drawbacks too, the major one of which, is that you don&#8217;t have control over the actual markup in the e-mail that&#8217;s being sent, so no advertising, changing colors and so on. But, we can live without that, right? :)</p>
<h2>The Subscription Form</h2>
<p>The easiest way to enable e-mail subscriptions, is to use the sidebar widget that Jetpack comes with. You can find a great tutorial on the <a href="http://wordpress.com/read/">Jetpack website</a>, however, today I&#8217;d like to show you how to totally customize that part by using your own form, handler and calls to the Jetpack API.</p>
<p>Note that to get this working, you will need public WordPress site with Jetpack enabled and linked to your WordPress.com account. So let&#8217;s begin with a simple form, somewhere in your theme template files:</p>
<pre>&lt;form method="POST"&gt;
    &lt;input type="hidden" name="my-form-action" value="subscribe" /&gt;
    &lt;input name="my-email" value="" placeholder="Enter your e-mail" /&gt;
    &lt;input type="submit" /&gt;
&lt;/form&gt;</pre>
<p><img class="alignnone size-full wp-image-3818" src="http://kovshenin.com/files/2012/02/subscribe-form-1.png" alt="Jetpack Subscription Form" width="677" height="228" /></p>
<p>That&#8217;s easy enough to understand, right? A hidden field that would tell us when the form is submitted, an input field for the e-mail address and a submit button. A <a href="http://codex.wordpress.org/Function_Reference/wp_nonce_field">nonce field</a> would be very useful too, but let&#8217;s try and keep it simple.</p>
<h2>The Subscription Form Handler</h2>
<p>Next, you will need something that will handle the form submission, somewhere in your theme&#8217;s functions.php file or preferably a plugin file (<a href="http://kovshenin.com/2012/plugins-vs-without-a-plugin/">here&#8217;s why</a>.)</p>
<pre>add_action( 'init', 'process_my_subscription_form' );
function process_my_subscription_form() {
    if ( isset( $_POST['my-form-action'] ) &amp;&amp; $_POST['my-form-action'] == 'subscribe' ) {
        $email = $_POST['my-email'];
        $subscribe = Jetpack_Subscriptions::subscribe( $email, 0, false );
        // check subscription status (to be continued)
    }
}</pre>
<p>This is quite simple to follow along too, we&#8217;re checking whether the form was submitted and then using the <code>subscribe</code> method of the <code>Jetpack_Subscriptions</code> class, which takes three arguments &#8212; e-mail address, a post ID (if you were subscribing to comments) and a boolean value for async versus sync calls. You shouldn&#8217;t worry about these for now.</p>
<p>This form handler, together with the above form, will already allow users to input their e-mail addresses and hit the submit button. They&#8217;ll get a notification to their e-mail address to confirm their subscription, and if they do, they&#8217;ll start receiving new posts from your website. Hurray! But wait&#8230;</p>
<h2>Subscription Status Feedback</h2>
<p>The problem, however, is that we haven&#8217;t provided any feedback about their subscription: was it successful, or are they already subscribed, or maybe they entered an invalid e-mail address. For this purpose, we should look at what the Jetpack subscribe method returned, and check for success or errors.</p>
<p>We don&#8217;t have to reinvent the weel here, but rather use the same code that is used in Jetpack&#8217;s e-mail subscriptions widget, right after calling the subscribe method:</p>
<pre>// check subscription status
if ( is_wp_error( $subscribe ) ) {
    $error = $subscribe-&gt;get_error_code();
} else {
    $error = false;
    foreach ( $subscribe as $response ) {
        if ( is_wp_error( $response ) ) {
            $error = $response-&gt;get_error_code();
            break;
        }
    }
}

if ( $error ) {
    switch( $error ) {
        case 'invalid_email':
            $redirect = add_query_arg( 'subscribe', 'invalid_email' );
            break;
        case 'active': case 'pending':
            $redirect = add_query_arg( 'subscribe', 'already' );
            break;
        default:
            $redirect = add_query_arg( 'subscribe', 'error' );
            break;
    }
} else {
    $redirect = add_query_arg( 'subscribe', 'success' );
}

wp_safe_redirect( $redirect );</pre>
<p>Although quite long, the code above is very easy to understand. We&#8217;re checking the <code>$subscribe</code> variable (returned from Jetpack) for whether it&#8217;s an error or an array of errors. If it&#8217;s an error, we read the error code, and change the <code>subscribe</code> query argument accordingly, with <code>add_query_arg</code>. This will add, for example, <code>?subscribe=invalid_email</code>, to our current URL.</p>
<p>If there was no error, we use <code>success</code> for that very same query argument. Finally, we redirect to our newly constructed URL. It&#8217;s much easier to understand when you&#8217;ll see this in action.</p>
<p><img class="alignnone size-full wp-image-3819" src="http://kovshenin.com/files/2012/02/subscribe-success.png" alt="E-mail subscription Success" width="500" height="70" /></p>
<p>At this point, you can test again by trying to subscribe, and you&#8217;ll see that the page is being redirected with the <code>subscribe</code> query argument added each time, showing the status of the subscription. Go ahead and enter an invalid e-mail address.</p>
<h2>The Subscription Form (again)</h2>
<p>Let&#8217;s return to our theme template where we rendered our subscription form and tweak it a little bit, based on our subscription status:</p>
<pre>&lt;?php $status = isset( $_REQUEST['subscribe'] ) ? $_REQUEST['subscribe'] : false; ?&gt;
&lt;?php if ( $status == 'invalid_email' ) : ?&gt;
    &lt;p&gt;You have entered an invalid e-mail, please try again!&lt;/p&gt;
&lt;?php elseif ( $status == 'success' ) : ?&gt;
    &lt;p&gt;Thank you for subscribing! Please check your e-mail to confirm.&lt;/p&gt;
&lt;?php else : ?&gt;
    &lt;form method="POST"&gt;
        &lt;input type="hidden" name="my-form-action" value="subscribe" /&gt;
        &lt;input name="my-email" value="" placeholder="Enter your e-mail" /&gt;
        &lt;input type="submit" /&gt;
    &lt;/form&gt;
&lt;?php endif; ?&gt;</pre>
<p>The first line will read the status into a variable, and then a check for the status with the relevant messages. I haven&#8217;t included all statuses for brevity, but you should have a couple more <code>elseif</code> blocks for &#8220;already&#8221; and &#8220;error&#8221;. Voila!</p>
<p><img class="alignnone size-large wp-image-3820" src="http://kovshenin.com/files/2012/02/thank-you-for-subscribing-680x211.png" alt="Thank you for subscribing" width="580" height="179" /></p>
<p><strong>What&#8217;s next?</strong> Well it&#8217;s up to you: you can customize the form however you like, you can redirect your visitors to a &#8220;thank you for subscribing&#8221; page (in the form handler,) or you can even send them an e-mail thanking them for their subscription :)</p>
<p>That&#8217;s about it! What&#8217;s your favorite way to handle e-mail subscriptions on your blog? What about newsletters, have you tried Jetpack to send out newsletters, or have you got a different preferred way? Share your thoughts and thanks for stopping by!</p>
]]></content:encoded>
			<wfw:commentRss>http://kovshenin.com/2012/using-jetpack-for-e-mail-subscriptions-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Hey WordPress, How About a WP_Plugin Class?</title>
		<link>http://kovshenin.com/2012/hey-wordpress-how-about-a-wp_plugin-class/</link>
		<comments>http://kovshenin.com/2012/hey-wordpress-how-about-a-wp_plugin-class/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 11:26:13 +0000</pubDate>
		<dc:creator>Konstantin Kovshenin</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[ideas]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://kovshenin.com/?p=3797</guid>
		<description><![CDATA[Okay January is my month of ideas :) Let&#8217;s talk about plugins for a moment, shall we? Actions and filters are no secret to WordPress developers, right? Say, how many times do you type something like this in your plugins or theme files: class Some_Plugin {     function __construct() {         [...]]]></description>
			<content:encoded><![CDATA[<p>Okay January is my month of ideas :) Let&#8217;s talk about plugins for a moment, shall we? Actions and filters are no secret to WordPress developers, right? Say, how many times do you type something like this in your plugins or theme files:</p>
<pre>class Some_Plugin {
    function __construct() {
        add_action( 'admin_init', array( $this, 'admin_init' ) );
    }

    function admin_init() {
        // Whatever
    }
}</pre>
<p>If you don&#8217;t, then you can stop reading now :) I&#8217;m addressing the naming technique here, the fact that admin_init is both an action tag, and a method that you assign to that action tag. So if I&#8217;m naming all my methods after actions and filters tags in WordPress, isn&#8217;t there a way to cut down the burden of having to add_action and add_filter all the time?</p>
<p>I&#8217;ve been thinking of an approach that could solve this problem in both, an easy to understand way, and a compatible way. Perhaps we&#8217;re lacking a WP_Plugin class in WordPress that would take care of this (along with a bunch of other things) for us, so that we can focus on writing our plugin, and not spend time matching tags to methods.</p>
<p>Here&#8217;s a concept that first popped into my mind, experimental and buggy, but something to get our heads thinking about it. If your class extends the WP_Plugin class, and your method&#8217;s name starts with a double-underscore prefix (or any other convention we may choose), and matches an existing action or filter, why not run the action or filter automatically without having to add_action or add_filter?</p>
<pre>class Some_Plugin extends WP_Plugin {
    function __admin_init() {
        // Will run during admin_init
    }

    function __the_content( $content ) {
        // Will filter the_content
        return $content;
    }
}</pre>
<p>Again, it&#8217;s just a thought and a lot of decisions should be made before implementing something like this. I went ahead and <a href="https://gist.github.com/1626284">drafted a plugin file</a> which works well to some extent. You can change the method name convention on line 18.</p>
<p>So my questions to you, dear reader are: is will this make things easier for the WordPress developers? Will this mess things up? What do you think of the prefix convention? How would you propose to handle the priority dilemma? What else could go into a WP_Plugin class?</p>
<p><strong>Update!</strong> It seems like <a href="http://php.net/manual/en/book.reflection.php">Reflection</a> is a better approach at what I&#8217;m trying to do, and separating actions from filters logic too. Thanks so much for the heads up Ryan McCue, Kaiser and Daniel Dvorkin. Here&#8217;s <a href="https://gist.github.com/1626492">Ryan&#8217;s improvement</a> over my first Gist.</p>
<p>Thanks for stopping by and <a href="http://kovshenin.com/feed/">subscribing</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://kovshenin.com/2012/hey-wordpress-how-about-a-wp_plugin-class/feed/</wfw:commentRss>
		<slash:comments>50</slash:comments>
		</item>
	</channel>
</rss>

