apply condition to pages created by user roles
if(isset($node) &amp;&amp; $node-&gt;type == 'page') {
  if($node-&gt;uid) {
    $node_author = user_load($node-&gt;uid);
    if(is_object($node_author)) {
      if(in_array("editor",$node_author-&gt;roles)) {
        // This is the condition to match the current node author belongs to editor role.
      }
    }
  }
}