Write a boolean function in template that determines if the logged user is either the node author or admin How do I write a function to determine if the user is either the node author or admin?

if ( logged user is author || admin ) {
  // …
}


It is for the node template.
Put this to template.php file of your theme:

function YOUR_THEME_NAME_preprocess_node(&amp;$variables) {
  global $user;

  if(in_array('administrator', $user-&gt;roles) || $variables['node']-&gt;uid == $user-&gt;uid) {
    $variables['is_admin_or_author'] = TRUE;
  }
  else {
    $variables['is_admin_or_author'] = FALSE;
  }
}


then in your node.tpl.php or node--your-content-type.tpl.php you'll have a variable $is_admin_or_author with either TRUE or FALSE value.