Hide Administrator Role Only

cneumann - October 14, 2008 - 03:51

A while back I figured out how to show user, role,and publisher / time stamp i.e.:

By John Smith
Administrator
-or-
Writer, Author
Published By On Sun, ##/##/2008 - #:##pm.

....Using the following custom code in node.tpl.php:

  <!--Authored By-->
  <div class="info"><?php print $submitteda ?></div>
  <!--Begin User Role-->
  <?php
  $poster
= user_load(array('uid' => $node->uid));
 
$poster = implode("," , $poster->roles);
 
$poster = explode("," , $poster);
  echo
$poster[1];
  if (
$poster[2] != "") echo ", ".$poster[2];
 
?>

  <!--End User Role-->
  <!--Submitted Date-->
  <div class="info"><?php print $submittedc ?></div>

Now, what I want to do is hide the role of "Administrator" ONLY from a panel or all node pages, all other roles are valid and I want them to show.

I was able to make the "By"-line and "Published" date/time using the global preferences in the theme. I tried a couple of IF/THEN statements and was not able to get it to work.

Anyone have any ideas?

I'm sorry my php is

harrisben - October 14, 2008 - 04:08

I'm sorry my php is terrible, but I believe what you want to do is check for userid '1', which is the administrator userid. You should be able to do a simple if/then statement to handle it. Of course, I say simple but it's beyond my abilities.

 
 

Drupal is a registered trademark of Dries Buytaert.