Today I needed to display content in a Drupal template file only for users who belong to a certain role. Specifically, I wanted to show a profile edit link (generated by a View), but only show it for those who are logged in and allowed to administer other users.
Drupal has a handy function called user_roles that is included with the User module. It will return an array of existing roles, so we just need to check it for the admin role:
<?php
if (in_array('admin', $user->roles)) {
// Put stuff here
} ?>
Where ‘admin’ is the role you are looking for. Easy-peasy.