Changing a template using user role and publishing variables I've been trying to get the following function to work in Drupal 7, where an unauthenticated user sees a different article template (in this case, node--article2.tpl) than a user that's logged in.  I get no php errors, but the template doesn't change if I'm logged out. What am I doing wrong here?

&lt;?php
   function mytheme_preprocess_node(&amp;$variables) {
   $node = $variables['node'];

   if($node-&gt;type === 'article'){
   global $user;
   if($user-&gt;uid == 0){
   $variables['template_file'] = 'node__article2';
  }
 }
}


Additionally, I'd like the function to look at an article's published state as well.  We're using the custom publishing options module that adds a publishing state of "archived." 

So basically unauthenticated users will get a different template that has a publishing state of archived.
change code 


  $variables['template_file'] = 'node__article2';


to


  $variables['theme_hook_suggestions'][] = 'node__article2';