How to print edit link on a node page if the current logged-in user has access to node edit
First of all you need to make sure to get access to your administrators as well as the author, also note that you need to load nid along with the uid

&lt;?php 
global $user;
$node = node_load(arg(1));
if(user_access('edit any "" content') || ($user-&gt;uid == $node-&gt;uid)){
    echo l(t('Edit this node'), 'node/' . $node-&gt;nid . '/edit');
}
?&gt;