<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: WordPress Settings API Tutorial</title>
	<atom:link href="http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/</link>
	<description>Random meanderings you&#039;re probably not interested in</description>
	<lastBuildDate>Mon, 02 Apr 2012 11:59:08 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-beta4-20725</generator>
	<item>
		<title>By: Keith</title>
		<link>http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/comment-page-1/#comment-1811</link>
		<dc:creator>Keith</dc:creator>
		<pubDate>Sun, 07 Mar 2010 15:27:18 +0000</pubDate>
		<guid isPermaLink="false">http://ottodestruct.com/blog/?p=583#comment-1811</guid>
		<description>Great tutorial, However is there a way to add default settings? If you use one database entry for all settings im assuming this would be done in an array?</description>
		<content:encoded><![CDATA[<p>Great tutorial, However is there a way to add default settings? If you use one database entry for all settings im assuming this would be done in an array?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Otto</title>
		<link>http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/comment-page-1/#comment-1810</link>
		<dc:creator>Otto</dc:creator>
		<pubDate>Fri, 05 Mar 2010 14:50:54 +0000</pubDate>
		<guid isPermaLink="false">http://ottodestruct.com/blog/?p=583#comment-1810</guid>
		<description>Normally, I don&#039;t have multiple &quot;submit&quot; buttons. If you want to have them and detect them, then you have to make them return individual bits that will identify their characteristics.

Note that my submit button in plugin_options_page() has no &quot;name&quot; on it. This is because I don&#039;t care about it. Buttons without names submit no extra parameters, they just submit. But, give it a name, and it returns the value on it.

There&#039;s two ways to do this.
1. Unique values
2. Unique names

The first way would look like this:
input type=&quot;submit&quot; name=&quot;plugin_options[submit]&quot; value=&quot;Submit&quot;
input type=&quot;submit&quot; name=&quot;plugin_options[submit]&quot; value=&quot;Reset&quot;

In this case, my validation function would get back an $input[&#039;submit&#039;] which would be set to either &quot;Submit&quot; or &quot;Reset&quot;, depending on which button I clicked. You could take action appropriately. Note that you would probably not want to set $newinput[&#039;submit&#039;] to return from this function, unless you wanted to store that value in the database for some strange reason...

Problem with this is that the &quot;value&quot; is what is actually displayed on the page. If you translate that into another language, your code now has to look for that value. It&#039;s problematic.

Second way:
input type=&quot;submit&quot; name=&quot;plugin_options[submit]&quot; value=&quot;Submit&quot;
input type=&quot;submit&quot; name=&quot;plugin_options[reset]&quot; value=&quot;Reset&quot;

In this case, I will get either $input[&#039;submit&#039;] or $input[&#039;reset&#039;] back. Because only one will come back depending on what button is pressed, I can ignore the value and take action based on which one is set. Similarly, I&#039;d want to not put this resulting value in $newinput, same as before.</description>
		<content:encoded><![CDATA[<p>Normally, I don&#8217;t have multiple &#8220;submit&#8221; buttons. If you want to have them and detect them, then you have to make them return individual bits that will identify their characteristics.</p>
<p>Note that my submit button in plugin_options_page() has no &#8220;name&#8221; on it. This is because I don&#8217;t care about it. Buttons without names submit no extra parameters, they just submit. But, give it a name, and it returns the value on it.</p>
<p>There&#8217;s two ways to do this.<br />
1. Unique values<br />
2. Unique names</p>
<p>The first way would look like this:<br />
input type=&#8221;submit&#8221; name=&#8221;plugin_options[submit]&#8221; value=&#8221;Submit&#8221;<br />
input type=&#8221;submit&#8221; name=&#8221;plugin_options[submit]&#8221; value=&#8221;Reset&#8221;</p>
<p>In this case, my validation function would get back an $input['submit'] which would be set to either &#8220;Submit&#8221; or &#8220;Reset&#8221;, depending on which button I clicked. You could take action appropriately. Note that you would probably not want to set $newinput['submit'] to return from this function, unless you wanted to store that value in the database for some strange reason&#8230;</p>
<p>Problem with this is that the &#8220;value&#8221; is what is actually displayed on the page. If you translate that into another language, your code now has to look for that value. It&#8217;s problematic.</p>
<p>Second way:<br />
input type=&#8221;submit&#8221; name=&#8221;plugin_options[submit]&#8221; value=&#8221;Submit&#8221;<br />
input type=&#8221;submit&#8221; name=&#8221;plugin_options[reset]&#8221; value=&#8221;Reset&#8221;</p>
<p>In this case, I will get either $input['submit'] or $input['reset'] back. Because only one will come back depending on what button is pressed, I can ignore the value and take action based on which one is set. Similarly, I&#8217;d want to not put this resulting value in $newinput, same as before.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/comment-page-1/#comment-1809</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Fri, 05 Mar 2010 14:41:51 +0000</pubDate>
		<guid isPermaLink="false">http://ottodestruct.com/blog/?p=583#comment-1809</guid>
		<description>That is where I&#039;m stuck too - there seems to be no way of determining which button (if you add a reset button) has been pressed</description>
		<content:encoded><![CDATA[<p>That is where I&#8217;m stuck too &#8211; there seems to be no way of determining which button (if you add a reset button) has been pressed</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Otto on WordPress &#187; Blog Archive &#187; WordPress Settings API Tutorial</title>
		<link>http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/comment-page-1/#comment-1808</link>
		<dc:creator>Otto on WordPress &#187; Blog Archive &#187; WordPress Settings API Tutorial</dc:creator>
		<pubDate>Thu, 04 Mar 2010 22:26:07 +0000</pubDate>
		<guid isPermaLink="false">http://ottodestruct.com/blog/?p=583#comment-1808</guid>
		<description>[...] WordPress Settings API Tutorial March 4, 2010, 4:25 pm   Originally posted here: http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/ [...]</description>
		<content:encoded><![CDATA[<p>[...] WordPress Settings API Tutorial March 4, 2010, 4:25 pm   Originally posted here: <a href="http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/" rel="nofollow">http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: My plugin removed from WP.org extend directory - Page 9 - WordPress Tavern Forum</title>
		<link>http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/comment-page-1/#comment-1807</link>
		<dc:creator>My plugin removed from WP.org extend directory - Page 9 - WordPress Tavern Forum</dc:creator>
		<pubDate>Thu, 11 Feb 2010 18:00:34 +0000</pubDate>
		<guid isPermaLink="false">http://ottodestruct.com/blog/?p=583#comment-1807</guid>
		<description>[...] the output sanitisation?    I prefer to do my validation of data on entry. I talk about this on my Settings API Tutorial, but basically I try not to save anything to the database that is untrusted.  I don&#039;t bother to [...]</description>
		<content:encoded><![CDATA[<p>[...] the output sanitisation?    I prefer to do my validation of data on entry. I talk about this on my Settings API Tutorial, but basically I try not to save anything to the database that is untrusted.  I don&#039;t bother to [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jani</title>
		<link>http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/comment-page-1/#comment-1806</link>
		<dc:creator>Jani</dc:creator>
		<pubDate>Fri, 05 Feb 2010 14:50:54 +0000</pubDate>
		<guid isPermaLink="false">http://ottodestruct.com/blog/?p=583#comment-1806</guid>
		<description>Thanks for taking the time to respond, Otto. I&#039;ll need to take another look at the code armed with the tips you gave.

Funnily, I just installed SFC today, and realized only afterwards the author links led me back to this blog. :)</description>
		<content:encoded><![CDATA[<p>Thanks for taking the time to respond, Otto. I&#8217;ll need to take another look at the code armed with the tips you gave.</p>
<p>Funnily, I just installed SFC today, and realized only afterwards the author links led me back to this blog. <img src='http://ottodestruct.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Otto</title>
		<link>http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/comment-page-1/#comment-1805</link>
		<dc:creator>Otto</dc:creator>
		<pubDate>Fri, 05 Feb 2010 14:40:04 +0000</pubDate>
		<guid isPermaLink="false">http://ottodestruct.com/blog/?p=583#comment-1805</guid>
		<description>I don&#039;t know what to tell you. I use this same technique in my Simple Facebook Connect plugin, and it works. I wrote this tutorial using things I learned from creating that plugin.

Check your register_setting call. That call basically turns on the setting, so that it can get whitelisted.

Also check your validation function. That function has to return the modified input, if you don&#039;t return anything, then the variables get lost and nothing gets saved.

Take a look at my &lt;a href=&quot;http://wordpress.org/extend/plugins/simple-facebook-connect/&quot; rel=&quot;nofollow&quot;&gt;SFC&lt;/a&gt; plugin. The base sfc.php file implements this, and you might see what you&#039;re missing. Note that it doesn&#039;t use any &quot;update_option&quot; calls anywhere.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t know what to tell you. I use this same technique in my Simple Facebook Connect plugin, and it works. I wrote this tutorial using things I learned from creating that plugin.</p>
<p>Check your register_setting call. That call basically turns on the setting, so that it can get whitelisted.</p>
<p>Also check your validation function. That function has to return the modified input, if you don&#8217;t return anything, then the variables get lost and nothing gets saved.</p>
<p>Take a look at my <a href="http://wordpress.org/extend/plugins/simple-facebook-connect/" rel="nofollow">SFC</a> plugin. The base sfc.php file implements this, and you might see what you&#8217;re missing. Note that it doesn&#8217;t use any &#8220;update_option&#8221; calls anywhere.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jani</title>
		<link>http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/comment-page-1/#comment-1804</link>
		<dc:creator>Jani</dc:creator>
		<pubDate>Fri, 05 Feb 2010 08:20:25 +0000</pubDate>
		<guid isPermaLink="false">http://ottodestruct.com/blog/?p=583#comment-1804</guid>
		<description>I&#039;m stumped. After failing to implement this into my own plugin, I took all the bits above and combined them into a fake plugin to see which part makes the difference. Turns out that plugin doesn&#039;t work either. By &quot;doesn&#039;t work&quot; I mean it does generate the custom settings page (as did my own plugin), and the input elements are functional, but the setting (the string) never gets saved. Tried this in WP 2.9.1 and 3.0-alpha, no difference. Is there something missing from the code above, or am I missing something? I&#039;m tempted to add some update_option()&#039;s, but I thought the whole point was, as you point out, that &quot;the options are automatically saved for you&quot;.</description>
		<content:encoded><![CDATA[<p>I&#8217;m stumped. After failing to implement this into my own plugin, I took all the bits above and combined them into a fake plugin to see which part makes the difference. Turns out that plugin doesn&#8217;t work either. By &#8220;doesn&#8217;t work&#8221; I mean it does generate the custom settings page (as did my own plugin), and the input elements are functional, but the setting (the string) never gets saved. Tried this in WP 2.9.1 and 3.0-alpha, no difference. Is there something missing from the code above, or am I missing something? I&#8217;m tempted to add some update_option()&#8217;s, but I thought the whole point was, as you point out, that &#8220;the options are automatically saved for you&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: WordCast 75: WordPress 2.9 and Beyond &#124; WordCast - Blogging news, WordPress help, WordPress plugins, WordPress themes, WordPress news</title>
		<link>http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/comment-page-1/#comment-1803</link>
		<dc:creator>WordCast 75: WordPress 2.9 and Beyond &#124; WordCast - Blogging news, WordPress help, WordPress plugins, WordPress themes, WordPress news</dc:creator>
		<pubDate>Mon, 11 Jan 2010 07:58:51 +0000</pubDate>
		<guid isPermaLink="false">http://ottodestruct.com/blog/?p=583#comment-1803</guid>
		<description>[...] Otto of OttoDestruct offers a WordPress Settings API Tutorial based upon the WordPress Settings API to help users understand better how the API works, with some great tips, too. [...]</description>
		<content:encoded><![CDATA[<p>[...] Otto of OttoDestruct offers a WordPress Settings API Tutorial based upon the WordPress Settings API to help users understand better how the API works, with some great tips, too. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thijs</title>
		<link>http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/comment-page-1/#comment-1802</link>
		<dc:creator>Thijs</dc:creator>
		<pubDate>Thu, 31 Dec 2009 11:30:23 +0000</pubDate>
		<guid isPermaLink="false">http://ottodestruct.com/blog/?p=583#comment-1802</guid>
		<description>Really nice tutorial, thanks!

Would you know of a way to detect which submit button is clicked when multiple ones are provided (e.g. to provide a reset option)? It seems like the form gets redirected following the submit, so I cannot capture the name of the reset button and hook options reset functionality into this.</description>
		<content:encoded><![CDATA[<p>Really nice tutorial, thanks!</p>
<p>Would you know of a way to detect which submit button is clicked when multiple ones are provided (e.g. to provide a reset option)? It seems like the form gets redirected following the submit, so I cannot capture the name of the reset button and hook options reset functionality into this.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using xcache
Object Caching 441/463 objects using xcache

Served from: ottodestruct.com @ 2012-05-21 13:43:52 -->
