<?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/"
		>
<channel>
	<title>Comments on: How to add additional user preference options in wordpress using profile page.</title>
	<atom:link href="http://www.dbuggr.com/smallwei/add-additional-user-preference-options-wordpress-profile-page/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dbuggr.com/smallwei/add-additional-user-preference-options-wordpress-profile-page/</link>
	<description>Share Knowledge &#38; Be Rewarded</description>
	<lastBuildDate>Wed, 28 Jul 2010 06:02:35 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: smallwei</title>
		<link>http://www.dbuggr.com/smallwei/add-additional-user-preference-options-wordpress-profile-page/comment-page-1/#comment-230</link>
		<dc:creator>smallwei</dc:creator>
		<pubDate>Tue, 03 Nov 2009 23:08:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.dbuggr.com/smallwei/add-additional-user-preference-options-wordpress-profile-page/#comment-230</guid>
		<description>This code is for adding additional checkbox preferences (News and notification) to user&#039;s metadata in profile page. The code is written based on &lt;a href=&quot;http://www.dquinn.net/adding-custom-user-meta-profile-fields-wordpress/&quot; rel=&quot;nofollow&quot;&gt;dquinn.net&#039;s&lt;/a&gt; excellent tutorial. If you need to know how to do radio buttons, textarea, dropdown ... etc, definitely check out the tutorial @
http://www.dquinn.net/adding-custom-user-meta-profile-fields-wordpress/

&lt;code&gt;/* Adding custom user profile meta data in Wordpress */
/* You can add this to an existing plugin or create your own plugin */

class custom_user_meta {

	function custom_user_meta() {

		add_action(&#039;show_user_profile&#039;, array(&amp;$this,&#039;action_show_user_profile&#039;));
		add_action(&#039;edit_user_profile&#039;, array(&amp;$this,&#039;action_show_user_profile&#039;));
		add_action(&#039;personal_options_update&#039;, array(&amp;$this,&#039;action_process_option_update&#039;));
		add_action(&#039;edit_user_profile_update&#039;, array(&amp;$this,&#039;action_process_option_update&#039;));

	}

	function action_show_user_profile() {
		global $user_id;
		?&gt;
		&lt;h3&gt;&lt;?php _e(&#039;E-mail&#039;); ?&gt;&lt;/h3&gt;

		&lt;table class=&quot;form-table&quot;&gt;

			&lt;tr&gt;
				&lt;th&gt;&lt;?php _e(&#039;Latest News&#039;); ?&gt;&lt;/th&gt;

	&lt;?php
		$email_array = get_the_author_meta(&#039;e_preference&#039;,$user_id);
	?&gt;			
				&lt;td&gt;
				&lt;label for=&quot;news&quot;&gt;&lt;input type=&quot;checkbox&quot; value=&quot;news&quot; name=&quot;e_preference[]&quot; id=&quot;news&quot; &lt;?php if (is_array($email_array)) { if (in_array(&quot;news&quot;,$email_array)) { ?&gt;checked=&quot;checked&quot;&lt;?php } }?&gt; class=&quot;news&quot; /&gt; E-mail updates and news.&lt;/label&gt;
				&lt;/td&gt;
			&lt;/tr&gt;	
			&lt;tr&gt;
				&lt;th&gt;&lt;?php _e(&#039;Notification&#039;); ?&gt;&lt;/th&gt;
				
				&lt;td&gt;
				&lt;label for=&quot;notify&quot;&gt;&lt;input type=&quot;checkbox&quot; value=&quot;notify&quot; name=&quot;e_preference[]&quot; id=&quot;notify&quot; &lt;?php if (is_array($email_array)) { if (in_array(&quot;notify&quot;,$email_array)) { ?&gt;checked=&quot;checked&quot;&lt;?php } }?&gt; class=&quot;notify&quot; /&gt; Receive important notification.&lt;/label&gt;
				&lt;/td&gt;
			&lt;/tr&gt;
		&lt;/table&gt;
	&lt;?php
	}

	
	function action_process_option_update() {
		global $user_id;
		
		update_usermeta( $user_id, &#039;e_preference&#039;, ( isset($_POST[&#039;e_preference&#039;]) ? $_POST[&#039;e_preference&#039;] : &#039;&#039; ) );
	}

}

add_action(&#039;plugins_loaded&#039;, create_function(&#039;&#039;,&#039;global $custom_user_meta_instance; $custom_user_meta_instance = new custom_user_meta();&#039;));&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>This code is for adding additional checkbox preferences (News and notification) to user&#8217;s metadata in profile page. The code is written based on <a href="http://www.dquinn.net/adding-custom-user-meta-profile-fields-wordpress/" rel="nofollow">dquinn.net&#8217;s</a> excellent tutorial. If you need to know how to do radio buttons, textarea, dropdown &#8230; etc, definitely check out the tutorial @<br />
<a href="http://www.dquinn.net/adding-custom-user-meta-profile-fields-wordpress/" rel="nofollow">http://www.dquinn.net/adding-custom-user-meta-profile-fields-wordpress/</a></p>
<p><pre><code>/* Adding custom user profile meta data in Wordpress */
/* You can add this to an existing plugin or create your own plugin */

class custom_user_meta {

&nbsp;&nbsp;function custom_user_meta() {

&nbsp;&nbsp;&nbsp;&nbsp;add_action(&#039;show_user_profile&#039;, array(&amp;$this,&#039;action_show_user_profile&#039;));
&nbsp;&nbsp;&nbsp;&nbsp;add_action(&#039;edit_user_profile&#039;, array(&amp;$this,&#039;action_show_user_profile&#039;));
&nbsp;&nbsp;&nbsp;&nbsp;add_action(&#039;personal_options_update&#039;, array(&amp;$this,&#039;action_process_option_update&#039;));
&nbsp;&nbsp;&nbsp;&nbsp;add_action(&#039;edit_user_profile_update&#039;, array(&amp;$this,&#039;action_process_option_update&#039;));

&nbsp;&nbsp;}

&nbsp;&nbsp;function action_show_user_profile() {
&nbsp;&nbsp;&nbsp;&nbsp;global $user_id;
&nbsp;&nbsp;&nbsp;&nbsp;?&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;h3&gt;&lt;?php _e(&#039;E-mail&#039;); ?&gt;&lt;/h3&gt;

&nbsp;&nbsp;&nbsp;&nbsp;&lt;table class=&quot;form-table&quot;&gt;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;&lt;?php _e(&#039;Latest News&#039;); ?&gt;&lt;/th&gt;

&nbsp;&nbsp;&lt;?php
&nbsp;&nbsp;&nbsp;&nbsp;$email_array = get_the_author_meta(&#039;e_preference&#039;,$user_id);
&nbsp;&nbsp;?&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;label for=&quot;news&quot;&gt;&lt;input type=&quot;checkbox&quot; value=&quot;news&quot; name=&quot;e_preference[]&quot; id=&quot;news&quot; &lt;?php if (is_array($email_array)) { if (in_array(&quot;news&quot;,$email_array)) { ?&gt;checked=&quot;checked&quot;&lt;?php } }?&gt; class=&quot;news&quot; /&gt; E-mail updates and news.&lt;/label&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/td&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;&lt;?php _e(&#039;Notification&#039;); ?&gt;&lt;/th&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;label for=&quot;notify&quot;&gt;&lt;input type=&quot;checkbox&quot; value=&quot;notify&quot; name=&quot;e_preference[]&quot; id=&quot;notify&quot; &lt;?php if (is_array($email_array)) { if (in_array(&quot;notify&quot;,$email_array)) { ?&gt;checked=&quot;checked&quot;&lt;?php } }?&gt; class=&quot;notify&quot; /&gt; Receive important notification.&lt;/label&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/td&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/table&gt;
&nbsp;&nbsp;&lt;?php
&nbsp;&nbsp;}

&nbsp;&nbsp;
&nbsp;&nbsp;function action_process_option_update() {
&nbsp;&nbsp;&nbsp;&nbsp;global $user_id;
&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;update_usermeta( $user_id, &#039;e_preference&#039;, ( isset($_POST[&#039;e_preference&#039;]) ? $_POST[&#039;e_preference&#039;] : &#039;&#039; ) );
&nbsp;&nbsp;}

}

add_action(&#039;plugins_loaded&#039;, create_function(&#039;&#039;,&#039;global $custom_user_meta_instance; $custom_user_meta_instance = new custom_user_meta();&#039;));</code></pre></p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->