I think I'm pretty close to what I need, but just need a little direction.
I'm trying to show a content widget in the backend to users of a certain role. Right now, I'm just testing it out with a user that has a role of subscriber
.
This works perfect :
<?php
// Add a widget to the WordPress dashboard
function wpc_dashboard_widget_function()
{
// Do whatever you want to render in here
echo '<div>
<h3>Special Offer One</h3>
<div>Special Offer Text will go here!</div>
</div>';
}
function wpc_add_dashboard_widgets()
{
wp_add_dashboard_widget('wp_dashboard_widget', 'Special Offers Just For
Vendors', 'wpc_dashboard_widget_function');
}
add_action('wp_dashboard_setup', 'wpc_add_dashboard_widgets' );
?>
But that shows it to all users. I would like to only show to a certain role and was trying to use:
if (!current_user_can('subscriber')):
endif;
along with it, but it just screws things up and the special widget doesn't show at all for anyone. Any ideas?