<?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 Extend Bulk Actions in WordPress</title>
	<atom:link href="http://valadilene.org/2009/08/15/how-to-extend-bulk-actions-in-wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://valadilene.org/2009/08/15/how-to-extend-bulk-actions-in-wordpress/</link>
	<description>web development, programming and music</description>
	<lastBuildDate>Wed, 28 Jul 2010 10:18:27 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Richard Tape</title>
		<link>http://valadilene.org/2009/08/15/how-to-extend-bulk-actions-in-wordpress/comment-page-1/#comment-1793</link>
		<dc:creator>Richard Tape</dc:creator>
		<pubDate>Fri, 04 Dec 2009 22:31:40 +0000</pubDate>
		<guid isPermaLink="false">http://valadilene.org/?p=410#comment-1793</guid>
		<description>Actually, you can ignore my e-mail. I&#039;ve managed to do what I wanted - I utilised some JavaScript to do it - through a bit of AJAX. If you&#039;re interested in finding out what I did, let me know</description>
		<content:encoded><![CDATA[<p>Actually, you can ignore my e-mail. I&#8217;ve managed to do what I wanted &#8211; I utilised some JavaScript to do it &#8211; through a bit of AJAX. If you&#8217;re interested in finding out what I did, let me know</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard Tape</title>
		<link>http://valadilene.org/2009/08/15/how-to-extend-bulk-actions-in-wordpress/comment-page-1/#comment-1788</link>
		<dc:creator>Richard Tape</dc:creator>
		<pubDate>Fri, 04 Dec 2009 12:13:07 +0000</pubDate>
		<guid isPermaLink="false">http://valadilene.org/?p=410#comment-1788</guid>
		<description>H! thanks for the reply. I&#039;ve sent you an e-mail also, to say thanks. ... plus there&#039;s a little request in there, too. :)</description>
		<content:encoded><![CDATA[<p>H! thanks for the reply. I&#8217;ve sent you an e-mail also, to say thanks. &#8230; plus there&#8217;s a little request in there, too. <img src='http://valadilene.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hangman</title>
		<link>http://valadilene.org/2009/08/15/how-to-extend-bulk-actions-in-wordpress/comment-page-1/#comment-1778</link>
		<dc:creator>Hangman</dc:creator>
		<pubDate>Sat, 28 Nov 2009 10:24:04 +0000</pubDate>
		<guid isPermaLink="false">http://valadilene.org/?p=410#comment-1778</guid>
		<description>@Richard: You can have a look at those hooks: manage_users_columns, manage_users_custom_column.

&lt;code&gt;
&lt;?php
add_filter(&#039;manage_users_columns&#039;, &#039;my_users_columns&#039;);
add_action(&#039;manage_users_custom_column&#039;, &#039;my_users_custom_column&#039;, 8, 3);
?&gt;
&lt;/code&gt;

First you add a new user column through manage_users_column:

&lt;code&gt;
&lt;?php
function my_users_columns($defaults) {
    $defaults[&#039;is_this_a_client&#039;] = __(&#039;Client?&#039;);
    return $defaults;
}
?&gt;
&lt;/code&gt;

Then you add content to this new column for each user through manage_users_custom_column.

&lt;code&gt;
&lt;?php
function wordbb_users_custom_column($value, $column_name, $id) {
	if($column_name!=&#039;is_this_a_client&#039;)
		return;

	// TODO: check if this user ($id) is a client in wp_usermeta
	$is_client=true;

	return &#039;&lt; input type=&quot;checkbox&quot; name=&quot;my_clients[&#039;.$id.&#039;]&quot;&lt;?php if($is_client) : ?&gt; checked=&quot;checked&quot;&lt;?php endif ?&gt; value=&quot;&lt;?php echo ($is_client)?&#039;1&#039;:&#039;0&#039; ?&gt;&quot; /&gt;&#039;;
}
?&gt;
&lt;/code&gt;

Note that in the return string we&#039;re creating an array of users (name attribute) which contains the boolean values for each checkbox, which you can now handle in your admin_users_update function.

&lt;code&gt;
&lt;?php
function admin_users_update()
{
	$clients=$_GET[&#039;my_clients&#039;];
	foreach($clients as $uid=&gt;$client)
	{
		// update wp_usermeta with new values
	}
}
?&gt;
&lt;/code&gt;

There may be errors in this code as I wrote it down right now without trying it.
Cheers!</description>
		<content:encoded><![CDATA[<p>@Richard: You can have a look at those hooks: manage_users_columns, manage_users_custom_column.</p>
<div class="codesnip-container" >< ?php<br />
add_filter('manage_users_columns', 'my_users_columns');<br />
add_action('manage_users_custom_column', 'my_users_custom_column', 8, 3);<br />
?></div>
<p>First you add a new user column through manage_users_column:</p>
<div class="codesnip-container" >< ?php<br />
function my_users_columns($defaults) {<br />
    $defaults['is_this_a_client'] = __('Client?');<br />
    return $defaults;<br />
}<br />
?></div>
<p>Then you add content to this new column for each user through manage_users_custom_column.</p>
<div class="codesnip-container" >< ?php<br />
function wordbb_users_custom_column($value, $column_name, $id) {<br />
	if($column_name!='is_this_a_client')<br />
		return;</p>
<p>	// TODO: check if this user ($id) is a client in wp_usermeta<br />
	$is_client=true;</p>
<p>	return '< input type="checkbox" name="my_clients['.$id.']"<?php if($is_client) : ?> checked=&#8221;checked&#8221;< ?php endif ?> value=&#8221;< ?php echo ($is_client)?'1':'0' ?>&#8221; />&#8217;;<br />
}<br />
?></div>
<p>Note that in the return string we&#8217;re creating an array of users (name attribute) which contains the boolean values for each checkbox, which you can now handle in your admin_users_update function.</p>
<div class="codesnip-container" >< ?php<br />
function admin_users_update()<br />
{<br />
	$clients=$_GET['my_clients'];<br />
	foreach($clients as $uid=>$client)<br />
	{<br />
		// update wp_usermeta with new values<br />
	}<br />
}<br />
?></div>
<p>There may be errors in this code as I wrote it down right now without trying it.<br />
Cheers!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard Tape</title>
		<link>http://valadilene.org/2009/08/15/how-to-extend-bulk-actions-in-wordpress/comment-page-1/#comment-1745</link>
		<dc:creator>Richard Tape</dc:creator>
		<pubDate>Fri, 27 Nov 2009 12:55:56 +0000</pubDate>
		<guid isPermaLink="false">http://valadilene.org/?p=410#comment-1745</guid>
		<description>Hi there! This is an excellent little article, however, would you be able to embellish a little further? I&#039;m trying to add a check box to this page (where you have added a drop down).

I&#039;ve already created the user meta and it appears on the user&#039;s profile page as you would expect (and it works fine). However, I&#039;m trying to make it a little easier for the site admin to check the status of one particular piece of user meta - therefore wanting it to be displayed on the users.php page.

For example, my extra piece of usermeta is called &quot;is_this_a_client&quot; and it&#039;s a simple checkbox. Would it be possible for me to add this particular checkbox to the users.php page and allow the admin to simply check it for several users at once instead of having to go into each individual user&#039;s profile?  I hope I&#039;m making sense, if I&#039;m not, please do let me know and I&#039;ll explain further.

Thank you for a great little snippet of code and I hope to hear from you soon! Kind regards from a rainy, dreary Manchester, England.</description>
		<content:encoded><![CDATA[<p>Hi there! This is an excellent little article, however, would you be able to embellish a little further? I&#8217;m trying to add a check box to this page (where you have added a drop down).</p>
<p>I&#8217;ve already created the user meta and it appears on the user&#8217;s profile page as you would expect (and it works fine). However, I&#8217;m trying to make it a little easier for the site admin to check the status of one particular piece of user meta &#8211; therefore wanting it to be displayed on the users.php page.</p>
<p>For example, my extra piece of usermeta is called &#8220;is_this_a_client&#8221; and it&#8217;s a simple checkbox. Would it be possible for me to add this particular checkbox to the users.php page and allow the admin to simply check it for several users at once instead of having to go into each individual user&#8217;s profile?  I hope I&#8217;m making sense, if I&#8217;m not, please do let me know and I&#8217;ll explain further.</p>
<p>Thank you for a great little snippet of code and I hope to hear from you soon! Kind regards from a rainy, dreary Manchester, England.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
