Hide and show logo based on user role Drupal 7

Is it possible to write an if statement in the page.tpl.php file that first gets the user role and then compares it to a string and it either shows the logo or doesn't. Something like...

//some how get user role

global $user;
$user_fields = user_load($user-&gt;uid);

$current_role = $user_fields-&gt;role[];

if ($current_role == "public_user"){
&gt;?
&lt;?php
 print $front_page; 
?&gt;" title="

&lt;?php
 print t('Home'); 
?&gt;
" rel="nofollow"&gt;

?&gt;
}else{
//don't show.
}
I'd suggest checking against a permission, rather than an entire role.

In your custom module, add:

function mymodule_permission() {
    return array(
        'view site logo' =&gt; array(
            'title' =&gt; t('View Site Logo'), 
            'description' =&gt; t('Allows a user to view the site logo'),
        ),
    );
}


And in your theme's template.php page preprocessor, add:

if(!user_access("view site logo")) {
    $variables['logo'] = "";
}


This way, $logo will not be processed in page.tpl.php for a user without the permission.