Quantcast
Channel: Lecciones Prácticas » Drupal
Viewing all articles
Browse latest Browse all 22

Drupal 7: quick-edit link for nodes for authorized users [SOLVED]

$
0
0

Showing a “edit this node” link for users who have authorization to edit that node is a useful feature.

The link will show only to logged users who have the editing privilege.

In Drupal7 this can be done by editing the node template and adding these lines to your node.tpl.php (or node–contenttypename-tpl.php)

  <!-- quick edit link -->
  <?php if(user_access('administer nodes')): 
      echo l(t('Edit this node'), 'node/' . $node->nid . '/edit');
   endif; ?>
  <!-- /quick edit link -->

Or:

<?php
if (node_access('update',$node)){
   print l(t('Edit'),'node/'.$node->nid.'/edit' );
}
?>

Viewing all articles
Browse latest Browse all 22

Trending Articles