I am looking for a way to alter the profile rendering of a user to exclude having user history displayed.

user-profile.tpl.php looks like this

<div class="profile"<?php print $attributes; ?>>
  <?php print render($user_profile); ?>
</div>

Now how can I alter that render (preferably building a custom module to have it not display the history section which is defined here http://api.drupal.org/api/drupal/modules--user--user.module/function/use...
as $page['content']['summary']

How can I make all the normal items display, except for the "summary"?

Comments

francort’s picture

You may want to take a look to the function hide()

like:

<div class="profile"<?php print $attributes; ?>>
  <?php hide($page['content']['summary']); print render($user_profile); ?>
</div>

cheers

nathamanath’s picture

function hook_page_alter(&$page){

$page['content']['system_main']['summary'] = null;

}

francort’s picture

Just an observation:

The documentation for hook_page_alter states:

if you are making changes to entities such as forms, menus, or user profiles, use those objects' native alter hooks instead (hook_form_alter(), for example).

So, if we are going for the hook approach, it would be better to use hook_user_view and/or hook_user_view_alter

Cheers!!