When a user logs in, I'd like him to see his profile info (name, address) with a link to a form to edit that info.
I thought this should be a trivial task, because it is something needed on almost every site that allows users to register. Yet, I failed to get anywhere after a couple of hours of trying and searching.

What I have now is a view (using the views module) that displays a list of all users where each one has a link to the edit page. But I only want a user to see and edit his own stuff ...

2 Answers 2


You may put template for user page like user-profile.tpl.php This template is used when viewing a registered member's profile page,

e.g., example.com/user/123. 123 being the users ID.

Available variables:

$user_profile: An array of profile items. Use render() to print them. Field variables: for each field instance attached to the user a corresponding variable is defined; e.g., $user->field_example has a variable $field_example defined. When needing to access a field's raw values, developers/themers are strongly encouraged to use these variables. Otherwise they will have to explicitly specify the desired field language, e.g. $user->field_example['en'], thus overriding any language negotiation rule that was previously applied.


use hook_menu_link_alter

function hook_menu_link_alter(&$item) {
  // Make all new admin links hidden (a.k.a disabled).
  if (strpos($item['link_path'], 'admin') === 0 && empty($item['mlid'])) {
    $item['hidden'] = 1;
  // Flag a link to be altered by hook_translated_menu_link_alter().
  if ($item['link_path'] == 'devel/cache/clear') {
    $item['options']['alter'] = TRUE;
  // Flag a link to be altered by hook_translated_menu_link_alter(), but only
  // if it is derived from a menu router item; i.e., do not alter a custom
  // menu link pointing to the same path that has been created by a user.
  if ($item['link_path'] == 'user' && $item['module'] == 'system') {
    $item['options']['alter'] = TRUE;
  • Thanks, Nikhil. I had found sth. like this before, but just couldn't believe it was necessary to write php code just to display profile data. I thought it was the whole point of the views module to get around such programming? That hook function thing I don't understand at all (what it's supposed to do, where to put it, how to call it). Would you have a link to documentation?
    – Ralf
    Apr 11, 2012 at 12:03
  • See here api.lullabot.com/group/menu_example/7
    – niksmac
    Apr 11, 2012 at 12:13
  • Thanks again. I'm sure it does, but I still don't see how this relates to the problem. Why would I want to alter a menu link? (The site that I'm working on doesn't even have a menu). Perhaps I'll get back to it in a couple of months after reading a couple more Drupal books ...
    – Ralf
    Apr 11, 2012 at 12:24
  • Now I tried to display $user_profile variables. But: $user_profile is NULL (tried in page.tpl.php). I also tried $user, which has content, but nothing useful for me ...
    – Ralf
    Apr 11, 2012 at 15:54
  • I think you cleared the cache. If yes try define this tpl through your template.php
    – niksmac
    Apr 11, 2012 at 16:40

I solved the same problem with the Rules module.

Same Question: https://stackoverflow.com/questions/6073793/how-to-redirect-a-user-to-his-account-page-after-login

  • CP is not asked for "redirect after login". Read before you answer.
    – niksmac
    Apr 11, 2012 at 12:01
  • Thanks for pointing me at this module and the redirections link. Only in this case I don't want to send users to another page, but simply display the profile info on a normal basic page, with a link to the account page.
    – Ralf
    Apr 11, 2012 at 12:13
  • Sorry for the misunderstanding. I thought that a redirect to the Profile edit Page would be the solution. Apr 11, 2012 at 12:22

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.