in node.tpl.php you have variable $view_mode, is there anythings like that in user-profile.tpl.php? user is bundle like node, and you can define different view modes for it.


I don't believe there is. There should be, and if I had to guess I'd say there will be in D8. Large parts of the entity api simply didn't get implemented in D7, and nodes were probably just considered a higher priority.

I believe the Profile2 modules work by extending the user entity, it may provide you with what you want. Otherwise my suggestion is Panels, which can control the user view via something called "Selection rules", instead of view modes.

  • 1
    $variables['elements']['#view_mode'] is what I found – Mohammad Ali Akbari Feb 24 '12 at 15:29
  • That's great, but can you actually change it? :) Perhaps display suite can do that. – Letharion Feb 24 '12 at 15:50
  • simply with hook_entity_info_alter – Mohammad Ali Akbari Feb 24 '12 at 15:59

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.