From 4005922332b3f51f86e29507ea1e19e179119493 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Wed, 14 Sep 2005 21:16:00 +0000 Subject: - Patch #31123 by Ber: make it easier to theme the user profile pages. --- modules/user/user.module | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'modules/user/user.module') diff --git a/modules/user/user.module b/modules/user/user.module index 1637928d4..147c4821e 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -467,7 +467,7 @@ function user_search($op = 'search', $keys = null) { */ function user_user($type, &$edit, &$user, $category = NULL) { if ($type == 'view') { - return array(t('History') => form_item(t('Member for'), format_interval(time() - $user->created))); + return array(t('History') => array('history'=> form_item(t('Member for'), format_interval(time() - $user->created)))); } if ($type == 'form' && $category == 'account') { @@ -618,10 +618,21 @@ function theme_user_picture($account) { } } +/** + * Theme a user page + * @param $account the user object + * @param $fields an mulidimensional array for the fields, in the form of + * array('category1'=> array('name1' => field1, 'name2' => field2), + * 'category2'=> array('name3' => field3, 'name4' => field4, 'name5' => field5), + * .. etc); + * + * @ingroup themeable + */ function theme_user_profile($account, $fields) { $output = "
\n"; $output .= theme('user_picture', $account); foreach ($fields as $category => $value) { + $value = implode('', $value); $output .= theme('box', $category, $value); } $output .= "
\n"; @@ -1281,11 +1292,10 @@ function user_view($uid = 0) { foreach (module_list() as $module) { if ($data = module_invoke($module, 'user', 'view', '', $account)) { foreach ($data as $category => $content) { - $fields[$category] .= $content; + $fields[$category] = $content; } } } - drupal_set_title($account->name); return theme('user_profile', $account, $fields); } -- cgit v1.2.3