2

i am building a website where many users will be able to add specific content. I want each content-node to have a link to the the authors profile page. I am using profile2 for users profiles and the alias of link in the node must be the "Company Name" field and not the username.

How can i achieve this?

Thank you!

2 Answers 2

1

Why don't you just use Views, and place that view towards the bottom of the article or that content type?

The views will be based on a user relationship with the node uid (the author's user id).

All those fields you require you can add to the user profile (admin/config/people/accounts/fields) - Company Name, Byline etc etc? And then display them via views.

1
  • It's 7 in the morning, so I'm quite groggy...If my answer doesn't apply, I'm sorry. If it makes sense and you still have doubts leave a comment, and I will update the answer in detail by the end of day. Commented Dec 11, 2013 at 1:22
0

create a template file for your content type, in your theme folder. it should be something like node--node_type.tpl.php . In that file you should have access to all the node's fields.

You can start by using the default node.tpl.php as an example. More about templates you can find here.

EDIT:

in your default node.tpl.php you could find something like this:

// this is taken from the omega theme
<?php if ($display_submitted): ?>
  <footer class="submitted"><?php print $date; ?> -- <?php print $name; ?></footer>
<?php endif; ?>

so instead of print $name you could do something like print l('your custom field value', 'user/' . $node->uid)

2
  • well, i am able to see the link but the problem is that i want to replace the description of the link with a field of the users profile. For example i have the link user44 wich links to user profile node. I want to replace "user44" with the Company Name. Company name is a field in the profile2. I dont know if my question is clear enough.
    – drupspark
    Commented Jun 15, 2012 at 13:04
  • yeah, it's clear but I think you did not understood what I was trying to say. I edited the answer, maybe this will be more clear. Commented Jun 15, 2012 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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