Display block if not in a role

Just put together the following snippet that will return false if the user does not have a specific role.

Please note that you will have to include the <?php ?> tags when you add this to your block PHP textarea.


<?php
  global $user;
if (in_array('Admitted Student', array_values($user->roles))) {
  return FALSE;
} else {
  return TRUE;
}
?>

Comments

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options