This question already has an answer here:

I have overwritten the user-profile-form with hook_form_alter.

Right now there are additional fields in the user-profile-form, so the user can add more information about him/her and these fields will be visible in /user/% page.

I'm wondering is it possible to add more details in /user/% without using the user-profile-form?

Let's say to display a field "Profile of [name_of_the_user]", so anyone who enters the user profile (Example John) in the top of the page will be displayed "Profile of John".

Is there any hook for that?

marked as duplicate by Mołot, Free Radical, Patrick Kenny, monymirza, niksmac Nov 13 '13 at 8:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


You can print the user name when a user is logged in using something like this...

<?php print t('Profile of '); print l($user->name,'user'); ?>

Which will display "Profile of John Smith". (This will only print the name of the user that is currently logged in)

When viewing another users profile, their name is printed as the page title. I haven't tried this myself, but you could just print the title again, with the additional text around it.

To do this...

<div><p>Profile of <?php print $title; ?></p></div>

Should do the trick, as long as it is only printed on the /user page. You should add the code to your custom user-profile.tpl.php. This will print the name of the users page you are looking at, instead of the currently logged in user.

  • Where should I put that code? Also the point is: in the website everyone can see the other profiles and when a user enters the profile page to other user, the name of that user should be displayed. – user2519032 Nov 6 '13 at 13:02
  • @user2519032 as to "Where should I put that code?" please see my comment under your answer :) "Possible duplicate" link is not meant to mock you, but to point you to the place where what you need to know was already described. – Mołot Nov 6 '13 at 13:17
  • Please see edited answer above. – Collins Nov 6 '13 at 13:20
  • Chris, thank you very much. Molot, thank you too for pointing the link. :) – user2519032 Nov 6 '13 at 13:42
  • Glad to help :) – Collins Nov 6 '13 at 13:50

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