Show link only to user with permission to edit
Assuming that you are talking of the blog content type, you should need to use code that checks:


If the user who is currently viewing the blog node is the author of the node and has the "edit own blog content" permission
If the user who is currently viewing the blog node is not the author of the node and has the "edit any blog content" permission

&lt;?php
  if ('[node:author:nid]' == $GLOBALS['user']-&gt;uid) {
    $permission = user_access('edit own blog content');
  }
  else {
    $permission = user_access('edit any blog content');
  } 
?&gt;
&lt;?php if ($permission): ?&gt;
  &lt;a href="&lt;?php print '[node:edit-url]';?&gt;"&gt;Edit&lt;/a&gt;
&lt;?php endif; ?&gt;



A more generic code would be the following one.

&lt;?php $item = menu_get_item('[node:edit-url]'); ?&gt;
&lt;?php if (!empty($item['access'])): ?&gt;
  &lt;a href="&lt;?php print '[node:edit-url]';?&gt;"&gt;Edit&lt;/a&gt;
&lt;?php endif; ?&gt;


This code is more generic because it shows the link whenever the current user has access to the edit link, whatever permissions are required to see that link. It could be a module alters which users can see the node edit page, and this code would take that in consideration.
The code is assuming [node:edit-url] is a URL like node/10/edit; if the URL is /node/10/edit or http://example.com/node/10/edit, then the code needs to be changed to extract the node/10/edit part, since that is the string menu_get_item() is expecting. See for example the code used by blog_menu_local_tasks_alter().

  // Add action link to 'node/add/blog' on 'blog' page.
  if ($root_path == 'blog') {
    $item = menu_get_item('node/add/blog');
    if ($item['access']) {
      $item['title'] = t('Create new blog entry');
      $data['actions']['output'][] = array(
        '#theme' =&gt; 'menu_local_action',
        '#link' =&gt; $item,
      );
    }
  }


That code is part of the Blog module, and it uses menu_get_item() to check if the currently logged-in user has access to the page to create a new blog. It doesn't merely verify the user has the permission to create a blog node, since that would not be enough if a module changes when a user can access the node create form.
Also note that the argument passed to menu_get_item() doesn't have a / at the beginning.

Notice that the Token module defines a URL token type, for which it makes available the following sub-tokens:


path, the path component of the URL
relative, the relative URL
absolute, the absolute URL
brief, the URL without the protocol and trailing backslash
unaliased, the unaliased URL
arg, the specific argument of the current page (e.g. 'arg:1' on the page 'node/1' returns '1')


Unfortunately, at the moment the type for node:edit-url is not set to url; when it is, the following code will work.

&lt;?php $item = menu_get_item('[node:edit-url:path]'); ?&gt;
&lt;?php if (!empty($item['access'])): ?&gt;
  &lt;a href="&lt;?php print '[node:edit-url]';?&gt;"&gt;Edit&lt;/a&gt;
&lt;?php endif; ?&gt;