<?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: Adding Dashboard Widgets to WordPress 2.7 Using Plugins</title>
	<atom:link href="http://simianuprising.com/2009/01/22/adding-dashboard-widgets-to-wordpress-27-using-plugins/feed/" rel="self" type="application/rss+xml" />
	<link>http://simianuprising.com/2009/01/22/adding-dashboard-widgets-to-wordpress-27-using-plugins/</link>
	<description></description>
	<lastBuildDate>Mon, 15 Mar 2010 18:22:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Jeremy Clarke</title>
		<link>http://simianuprising.com/2009/01/22/adding-dashboard-widgets-to-wordpress-27-using-plugins/comment-page-1/#comment-96615</link>
		<dc:creator>Jeremy Clarke</dc:creator>
		<pubDate>Mon, 20 Apr 2009 21:02:48 +0000</pubDate>
		<guid isPermaLink="false">http://simianuprising.com/2009/01/22/adding-dashboard-widgets-to-wordpress-27-using-plugins/#comment-96615</guid>
		<description>@Maraya not really at this point. I have other plugins that are all basically waiting on a bunch of work I need to do on my own site before I can start hosting them here. At some point I might release it and i&#039;ll leave a comment on this post to notify you, but I wouldn&#039;t count on it if I was you, I&#039;m pretty busy.</description>
		<content:encoded><![CDATA[<p>@Maraya not really at this point. I have other plugins that are all basically waiting on a bunch of work I need to do on my own site before I can start hosting them here. At some point I might release it and i&#8217;ll leave a comment on this post to notify you, but I wouldn&#8217;t count on it if I was you, I&#8217;m pretty busy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maraya</title>
		<link>http://simianuprising.com/2009/01/22/adding-dashboard-widgets-to-wordpress-27-using-plugins/comment-page-1/#comment-96609</link>
		<dc:creator>Maraya</dc:creator>
		<pubDate>Mon, 20 Apr 2009 19:24:11 +0000</pubDate>
		<guid isPermaLink="false">http://simianuprising.com/2009/01/22/adding-dashboard-widgets-to-wordpress-27-using-plugins/#comment-96609</guid>
		<description>Jeremy,

I want this dashboard plugin, but know that coding it myself will be a nightmare.  Any plans to create a distribute this as a plugin file?

thanks,
Maraya</description>
		<content:encoded><![CDATA[<p>Jeremy,</p>
<p>I want this dashboard plugin, but know that coding it myself will be a nightmare.  Any plans to create a distribute this as a plugin file?</p>
<p>thanks,<br />
Maraya</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeremy Clarke</title>
		<link>http://simianuprising.com/2009/01/22/adding-dashboard-widgets-to-wordpress-27-using-plugins/comment-page-1/#comment-94862</link>
		<dc:creator>Jeremy Clarke</dc:creator>
		<pubDate>Tue, 07 Apr 2009 19:36:03 +0000</pubDate>
		<guid isPermaLink="false">http://simianuprising.com/2009/01/22/adding-dashboard-widgets-to-wordpress-27-using-plugins/#comment-94862</guid>
		<description>Hey Mark. Its actually a lot easier than what you&#039;re attempting. You should remove your is_user_logged_in() check, as its unnecessary since you&#039;re already going to be checking for a specific role, and replace it with a check for current_user_can(), which checked logged-inness as well as for a specific role/capability. You use it like this:

&lt;code&gt;
if (current_user_can(&#039;publish_posts&#039;)) :
    widget_stuff();
endif;
&lt;/code&gt;

It works best with &#039;capabilities&#039;, actual things you can do, like &#039;edit_users&#039;, &#039;manage_options&#039;, &#039;read&#039; etc, but you can also use it with role labels like &#039;admin&#039;, &#039;editor&#039; etc. If you really want to check multiple role labels you could just have more than one clause in you IF statement ( if (current_user_can(&#039;editor&#039;) OR current_user_can(&#039;admin&#039;) ), but it would probably be better to just identify one capability that the roles share and check for that instead (like maybe &#039;edit_others_posts&#039;, which &#039;authors&#039; dont&#039; have). If you&#039;re not sure what capabilities are shared by certain roles I recommend the Role Manager plugin, it gives you extra control over roles in wordpress and also just helps you visualize what&#039;s going on with the different role levels and capabilities.</description>
		<content:encoded><![CDATA[<p>Hey Mark. Its actually a lot easier than what you&#8217;re attempting. You should remove your is_user_logged_in() check, as its unnecessary since you&#8217;re already going to be checking for a specific role, and replace it with a check for current_user_can(), which checked logged-inness as well as for a specific role/capability. You use it like this:</p>
<p><code><br />
if (current_user_can('publish_posts')) :<br />
    widget_stuff();<br />
endif;<br />
</code></p>
<p>It works best with &#8216;capabilities&#8217;, actual things you can do, like &#8216;edit_users&#8217;, &#8216;manage_options&#8217;, &#8216;read&#8217; etc, but you can also use it with role labels like &#8216;admin&#8217;, &#8216;editor&#8217; etc. If you really want to check multiple role labels you could just have more than one clause in you IF statement ( if (current_user_can(&#8216;editor&#8217;) OR current_user_can(&#8216;admin&#8217;) ), but it would probably be better to just identify one capability that the roles share and check for that instead (like maybe &#8216;edit_others_posts&#8217;, which &#8216;authors&#8217; dont&#8217; have). If you&#8217;re not sure what capabilities are shared by certain roles I recommend the Role Manager plugin, it gives you extra control over roles in wordpress and also just helps you visualize what&#8217;s going on with the different role levels and capabilities.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://simianuprising.com/2009/01/22/adding-dashboard-widgets-to-wordpress-27-using-plugins/comment-page-1/#comment-94859</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Tue, 07 Apr 2009 19:18:44 +0000</pubDate>
		<guid isPermaLink="false">http://simianuprising.com/2009/01/22/adding-dashboard-widgets-to-wordpress-27-using-plugins/#comment-94859</guid>
		<description>The gods must be smiling on me. Just read the codex article and a google search landed me here. I&#039;m trying hide a dashboard widget to all but admins and a particular role. How could I wrap some code around the widget to do that?

I have been playing with the code below but with no luck just yet:

&lt;code&gt;//Pre-check user status and role
  if(is_user_logged_in) { // only if there is a user logged in
   $user = wp_get_current_user();
   $user_roles = $user-&gt;roles; // an array of roles
     foreach($user_roles as $user_role)
   {
	  if($user_role==&#039;administrator&#039; &#124;&#124; $user_role==&#039;intern&#039;)
   }
  }
//DASHBOARD CODE
function assignments_add_dashboard_widgets() {
	wp_add_dashboard_widget(&#039;assignments&#039;, &#039;Assignment Sheet&#039;, &#039;assignments_dashboard_widget_function&#039;);	
}
// Hoook into the dashboard
add_action(&#039;wp_dashboard_setup&#039;, &#039;assignments_add_dashboard_widgets&#039;);&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>The gods must be smiling on me. Just read the codex article and a google search landed me here. I&#8217;m trying hide a dashboard widget to all but admins and a particular role. How could I wrap some code around the widget to do that?</p>
<p>I have been playing with the code below but with no luck just yet:</p>
<p><code>//Pre-check user status and role<br />
  if(is_user_logged_in) { // only if there is a user logged in<br />
   $user = wp_get_current_user();<br />
   $user_roles = $user-&gt;roles; // an array of roles<br />
     foreach($user_roles as $user_role)<br />
   {<br />
	  if($user_role=='administrator' || $user_role=='intern')<br />
   }<br />
  }<br />
//DASHBOARD CODE<br />
function assignments_add_dashboard_widgets() {<br />
	wp_add_dashboard_widget('assignments', 'Assignment Sheet', 'assignments_dashboard_widget_function');<br />
}<br />
// Hoook into the dashboard<br />
add_action('wp_dashboard_setup', 'assignments_add_dashboard_widgets');</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RaiulBaztepo</title>
		<link>http://simianuprising.com/2009/01/22/adding-dashboard-widgets-to-wordpress-27-using-plugins/comment-page-1/#comment-92392</link>
		<dc:creator>RaiulBaztepo</dc:creator>
		<pubDate>Sat, 28 Mar 2009 23:04:05 +0000</pubDate>
		<guid isPermaLink="false">http://simianuprising.com/2009/01/22/adding-dashboard-widgets-to-wordpress-27-using-plugins/#comment-92392</guid>
		<description>Hello!
Very Interesting post! Thank you for such interesting resource! 
PS: Sorry for my bad english, I&#039;v just started to learn this language ;)
See you! 
Your, Raiul Baztepo</description>
		<content:encoded><![CDATA[<p>Hello!<br />
Very Interesting post! Thank you for such interesting resource!<br />
PS: Sorry for my bad english, I&#8217;v just started to learn this language ;)<br />
See you!<br />
Your, Raiul Baztepo</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeremy Clarke</title>
		<link>http://simianuprising.com/2009/01/22/adding-dashboard-widgets-to-wordpress-27-using-plugins/comment-page-1/#comment-90966</link>
		<dc:creator>Jeremy Clarke</dc:creator>
		<pubDate>Mon, 23 Mar 2009 03:08:44 +0000</pubDate>
		<guid isPermaLink="false">http://simianuprising.com/2009/01/22/adding-dashboard-widgets-to-wordpress-27-using-plugins/#comment-90966</guid>
		<description>@wiz: You&#039;d want to put it in some plugin code. Either in a plugin file you create (its easy, check the codex page for the outline of creating a simple plugin) or in the functions.php file of a theme. The example code also doesn&#039;t have a hook in it. I think when I wrote it I was assuming that you&#039;d just add the code in that function into the rest of the dashboard related code in your plugin.</description>
		<content:encoded><![CDATA[<p>@wiz: You&#8217;d want to put it in some plugin code. Either in a plugin file you create (its easy, check the codex page for the outline of creating a simple plugin) or in the functions.php file of a theme. The example code also doesn&#8217;t have a hook in it. I think when I wrote it I was assuming that you&#8217;d just add the code in that function into the rest of the dashboard related code in your plugin.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wiz</title>
		<link>http://simianuprising.com/2009/01/22/adding-dashboard-widgets-to-wordpress-27-using-plugins/comment-page-1/#comment-90940</link>
		<dc:creator>wiz</dc:creator>
		<pubDate>Mon, 23 Mar 2009 01:27:13 +0000</pubDate>
		<guid isPermaLink="false">http://simianuprising.com/2009/01/22/adding-dashboard-widgets-to-wordpress-27-using-plugins/#comment-90940</guid>
		<description>I just came across this page when searching for a custom WP 2.7 Dashboard. Thanks a lot for the Codex entry. I see you have included the info on how to remove the default widgets. Does it matter where this code is placed for it to work? Should I place it in the dashboard.php file?</description>
		<content:encoded><![CDATA[<p>I just came across this page when searching for a custom WP 2.7 Dashboard. Thanks a lot for the Codex entry. I see you have included the info on how to remove the default widgets. Does it matter where this code is placed for it to work? Should I place it in the dashboard.php file?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Crystal</title>
		<link>http://simianuprising.com/2009/01/22/adding-dashboard-widgets-to-wordpress-27-using-plugins/comment-page-1/#comment-76004</link>
		<dc:creator>Crystal</dc:creator>
		<pubDate>Wed, 04 Feb 2009 07:16:14 +0000</pubDate>
		<guid isPermaLink="false">http://simianuprising.com/2009/01/22/adding-dashboard-widgets-to-wordpress-27-using-plugins/#comment-76004</guid>
		<description>Hi there,

Just a quick note to thank you for the Codex addition, and also for the note you added about the Dashboard RSS feeds.

I&#039;m just starting to explore WP hacking. I have experience with PHP, CSS, and XHTML, but putting all the bits together (and figuring out where to put them!) is still tricky. 

Big thanks for shining the light,
Crystal</description>
		<content:encoded><![CDATA[<p>Hi there,</p>
<p>Just a quick note to thank you for the Codex addition, and also for the note you added about the Dashboard RSS feeds.</p>
<p>I&#8217;m just starting to explore WP hacking. I have experience with PHP, CSS, and XHTML, but putting all the bits together (and figuring out where to put them!) is still tricky. </p>
<p>Big thanks for shining the light,<br />
Crystal</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simian Uprising &#124; Jeremy Clarke Â» Adding Dashboard Widgets to &#8230; &#171; WidGet Blog</title>
		<link>http://simianuprising.com/2009/01/22/adding-dashboard-widgets-to-wordpress-27-using-plugins/comment-page-1/#comment-72317</link>
		<dc:creator>Simian Uprising &#124; Jeremy Clarke Â» Adding Dashboard Widgets to &#8230; &#171; WidGet Blog</dc:creator>
		<pubDate>Fri, 23 Jan 2009 11:47:55 +0000</pubDate>
		<guid isPermaLink="false">http://simianuprising.com/2009/01/22/adding-dashboard-widgets-to-wordpress-27-using-plugins/#comment-72317</guid>
		<description>[...] See the original post here: Simian Uprising &#124; Jeremy Clarke Â» Adding Dashboard Widgets to &#8230; [...]</description>
		<content:encoded><![CDATA[<p>[...] See the original post here: Simian Uprising | Jeremy Clarke Â» Adding Dashboard Widgets to &#8230; [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
