With latest project I had loads of solutions on contacting the original author of a Drupal node. But with client demand the simplest would win: here you go, a tiny Drupal 7 snippet for node template to facilitate contact for a node author (if you have contact module enabled). It also features an access permission check so only registered users could access that link.

You would need to put in your node--YOUR-CONTENT-TYPE-NAME.tpl.php of course. And to remove Bootstrap 3 style you can delete array('attributes' => array('class' => 'btn btn-warning')) part of course.

<?php if (in_array('authenticated user', $user->roles)): ?>
<?php print l('Contact owner', "user/" . $node->uid . "/contact", array('attributes' => array('class' => 'btn btn-warning'))); ?>
<?php endif; ?>
Add new comment