By DevJoshLopez on
I am trying to create a link to edit nodes but right now it is showing on every page. I need it to show the link only if the current user can edit the node.
This is what i have right now.
<div><?php print l('Edit', 'node/' . $node->nid . '/edit', array('query' => drupal_get_destination())); ?></div>
After I get the link to show only to users that can edit the node I am going to make the link an icon next to the page title.
Thank you for your help.
Comments
I tried to add <?php if
I tried to add
But it prints only for admin user.
I also tried:<?php $path
I also tried:
but thats giving me Notice: Undefined variable: node in include()
Try this:<?phpif (arg(0) ==
Try this:
What's new and changing in PHP 8.4
I also need it to not print
I also need it to not print on view pages
This prints on view
This prints on view pages:
Maybe you could reverse the conditions?
Sam.
Solution using hook
Solution using hook_preprocess_node and node.tpl.php template: http://stackoverflow.com/a/33258230/1127583