0

I would like to customize the 'submitted by user' section of certain contact types and add a 'contact author' link.

4

You certainly shouldn't need to hack core for this. There's a few ways to do this, the simplest way is to customise node.tpl.php. For example if you were using the default node.tpl.php you would copy it to your theme folder, rename it "node--yourcontenttype.tpl.php" and then open it up and find the code:

<?php if ($display_submitted): ?>
  <div class="submitted">
    <?php print $submitted; ?>
  </div>
<?php endif; ?>

You can then add the code to generate your contact link, something like this (untested):

<?php if ($display_submitted): ?>
  <div class="submitted">
    <?php print $submitted; ?>
    <a class="user-contact" href="/user/<?php print $uid; ?>/contact">Contact</a>
  </div>
<?php endif; ?>
  • 2
    Some notes: use l() or url(); check if user has access to use contact form with user_access('access user contact forms'). – kalabro Aug 13 '12 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.