How do I print the edit link on a node page if the currently logged-in user has the permission to edit the node?
I’m using Display Suite custom fields to have the edit link rendered somewhere else on the node page. Is there an easy way to verify the currently logged-in user has the permission to edit the node?.
So far I tried this code.
global $user; if (node_access('update', $nid, $user)) { echo l(t('Edit this node'), 'node/' . $node->nid . '/edit'); }
What code should I instead use?
This article was republished from its original source.
Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.