diff --git a/modules/blog.module b/modules/blog.module index 9b18115d4b58a09abeab4059a299310d77f42081..bd1c00fe725314cd54f5f8425c0c87072b0f087d 100644 --- a/modules/blog.module +++ b/modules/blog.module @@ -38,7 +38,7 @@ function blog_access($op, $node) { function blog_user($type, &$edit, &$user) { if ($type == 'view' && user_access("maintain personal blog", $user)) { - return form_item(t("Blog"), l(t("view recent blog entries"), "blog/$user->uid", array("title" => t("Read %username's latest blog entries.", array("%username" => $user->name))))); + return array(t('History') => form_item(t("Blog"), l(t("view recent blog entries"), "blog/$user->uid", array("title" => t("Read %username's latest blog entries.", array("%username" => $user->name)))))); } } diff --git a/modules/blog/blog.module b/modules/blog/blog.module index 9b18115d4b58a09abeab4059a299310d77f42081..bd1c00fe725314cd54f5f8425c0c87072b0f087d 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -38,7 +38,7 @@ function blog_access($op, $node) { function blog_user($type, &$edit, &$user) { if ($type == 'view' && user_access("maintain personal blog", $user)) { - return form_item(t("Blog"), l(t("view recent blog entries"), "blog/$user->uid", array("title" => t("Read %username's latest blog entries.", array("%username" => $user->name))))); + return array(t('History') => form_item(t("Blog"), l(t("view recent blog entries"), "blog/$user->uid", array("title" => t("Read %username's latest blog entries.", array("%username" => $user->name)))))); } } diff --git a/modules/comment.module b/modules/comment.module index b7676eaaf051e7ab7e8d7be8fda287649e913a0b..03f6144bd7ecdf2ee3ad740922339ac8e3679ef2 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -138,11 +138,6 @@ function comment_settings() { function comment_user($type, $edit, &$user) { switch ($type) { - case "view": - if ($user->signature) { - return form_item(t("Signature"), check_output($user->signature)); - } - break; case "edit": // when user tries to edit his own data return array(t('Personal information') => form_textarea(t("Signature"), "signature", $user->signature, 64, 3, t("Your signature will be publicly displayed at the end of your comments.") ."<br />". filter_tips_short())); diff --git a/modules/comment/comment.module b/modules/comment/comment.module index b7676eaaf051e7ab7e8d7be8fda287649e913a0b..03f6144bd7ecdf2ee3ad740922339ac8e3679ef2 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -138,11 +138,6 @@ function comment_settings() { function comment_user($type, $edit, &$user) { switch ($type) { - case "view": - if ($user->signature) { - return form_item(t("Signature"), check_output($user->signature)); - } - break; case "edit": // when user tries to edit his own data return array(t('Personal information') => form_textarea(t("Signature"), "signature", $user->signature, 64, 3, t("Your signature will be publicly displayed at the end of your comments.") ."<br />". filter_tips_short())); diff --git a/modules/profile.module b/modules/profile.module index 4efc5b65653a1323103cf83a533ab980746309f5..7dae358955b927383045fbea6b4ddc12c633f605 100644 --- a/modules/profile.module +++ b/modules/profile.module @@ -129,15 +129,15 @@ function profile_view_profile($user) { while ($field = db_fetch_object($result)) { if ($value = profile_view_field($user, $field)) { if ($field->type == 'checkbox') { - $output .= "<p>$value</p>"; + $fields[$field->category] .= "<p>$value</p>"; } else { - $output .= form_item($field->title, check_output($value)); + $fields[$field->category] .= form_item($field->title, check_output($value)); } } } - return $output; + return $fields; } function profile_edit_profile($edit, $user) { diff --git a/modules/profile/profile.module b/modules/profile/profile.module index 4efc5b65653a1323103cf83a533ab980746309f5..7dae358955b927383045fbea6b4ddc12c633f605 100644 --- a/modules/profile/profile.module +++ b/modules/profile/profile.module @@ -129,15 +129,15 @@ function profile_view_profile($user) { while ($field = db_fetch_object($result)) { if ($value = profile_view_field($user, $field)) { if ($field->type == 'checkbox') { - $output .= "<p>$value</p>"; + $fields[$field->category] .= "<p>$value</p>"; } else { - $output .= form_item($field->title, check_output($value)); + $fields[$field->category] .= form_item($field->title, check_output($value)); } } } - return $output; + return $fields; } function profile_edit_profile($edit, $user) { diff --git a/modules/system.module b/modules/system.module index ae588c7ddf093ebf1492ac55232d7add77b3c95b..1c5e7b95f20d614b39fa64a8c437bc9e97b68810 100644 --- a/modules/system.module +++ b/modules/system.module @@ -95,6 +95,9 @@ function system_user($type, $edit, &$user) { $data[t('Locale settings')] = form_select(t("Time zone"), "timezone", $edit["timezone"], $zones, t("Select what time you currently have and your time zone settings will be set appropriate.")); return $data; } + else if ($type == 'view') { + // do nothing + } else { return $edit; } diff --git a/modules/system/system.module b/modules/system/system.module index ae588c7ddf093ebf1492ac55232d7add77b3c95b..1c5e7b95f20d614b39fa64a8c437bc9e97b68810 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -95,6 +95,9 @@ function system_user($type, $edit, &$user) { $data[t('Locale settings')] = form_select(t("Time zone"), "timezone", $edit["timezone"], $zones, t("Select what time you currently have and your time zone settings will be set appropriate.")); return $data; } + else if ($type == 'view') { + // do nothing + } else { return $edit; } diff --git a/modules/tracker.module b/modules/tracker.module index fbf587ff60ab2567f95d851a40bd385b277785e6..a700f13dc67da6a0395721ba91b0b42970c805e0 100644 --- a/modules/tracker.module +++ b/modules/tracker.module @@ -76,7 +76,8 @@ function tracker_page() { function tracker_user($type, &$edit, &$user) { if ($type == 'view' && user_access("access content")) { - return form_item(t("Recent posts"), l(t("recent posts"), "tracker/$user->uid")); + return array(t('History') => form_item(t("Recent posts"), l(t("recent posts"), "tracker/$user->uid"))); + return $fields; } } diff --git a/modules/tracker/tracker.module b/modules/tracker/tracker.module index fbf587ff60ab2567f95d851a40bd385b277785e6..a700f13dc67da6a0395721ba91b0b42970c805e0 100644 --- a/modules/tracker/tracker.module +++ b/modules/tracker/tracker.module @@ -76,7 +76,8 @@ function tracker_page() { function tracker_user($type, &$edit, &$user) { if ($type == 'view' && user_access("access content")) { - return form_item(t("Recent posts"), l(t("recent posts"), "tracker/$user->uid")); + return array(t('History') => form_item(t("Recent posts"), l(t("recent posts"), "tracker/$user->uid"))); + return $fields; } } diff --git a/modules/user.module b/modules/user.module index 9fd0a971fe480b8a6de1d91071f0ee7493e16b7e..7d2b3338027f306cf79ef6bf6a3986ad5049d164 100644 --- a/modules/user.module +++ b/modules/user.module @@ -333,6 +333,12 @@ function user_search($keys) { return array(t("Matching users"), $find); } +function user_user($type, &$edit, &$user) { + if ($type == 'view') { + return array(t('History') => form_item(t('Member for'), format_interval(time() - $account->created))); + } +} + function user_block($op = "list", $delta = 0) { global $user; @@ -478,12 +484,12 @@ function theme_user_picture($account) { } } -function theme_user_profile($account) { +function theme_user_profile($account, $fields) { $output = "<div class=\"profile\">\n"; $output .= theme('user_picture', $account); - $output .= form_item(t('Name'), $account->name); - $output .= implode("\n", module_invoke_all('user', 'view', '', $account)); - $output .= form_item(t('Member for'), format_interval(time() - $account->created)); + foreach ($fields as $category => $value) { + $output .= "<h2>$category</h2>$value"; + } if (user_access("administer users")) { $output .= form_item(t("Administration"), l(t("edit account"), "admin/user/edit/$account->uid")); @@ -1077,7 +1083,16 @@ function user_view($uid = 0) { if ($uid == 0) { if ($user->uid) { - print theme('page', theme('user_profile', $user), $user->name); + // Retrieve and merge all profile fields: + $fields = array(); + foreach (module_list() as $module) { + if ($data = module_invoke($module, 'user', 'view', '', $user)) { + foreach ($data as $category => $content) { + $fields[$category] .= $content; + } + } + } + print theme('page', theme('user_profile', $user, $fields), $user->name); } else { $output = user_login(); @@ -1091,7 +1106,17 @@ function user_view($uid = 0) { } else { if ($account = user_load(array('uid' => $uid, "status" => 1))) { - print theme('page', theme('user_profile', $account), $account->name); + // Retrieve and merge all profile fields: + $fields = array(); + foreach (module_list() as $module) { + if ($data = module_invoke($module, 'user', 'view', '', $account)) { + foreach ($data as $category => $content) { + $fields[$category] .= $content; + } + } + } + + print theme('page', theme('user_profile', $account, $fields), $account->name); } else { drupal_not_found(); diff --git a/modules/user/user.module b/modules/user/user.module index 9fd0a971fe480b8a6de1d91071f0ee7493e16b7e..7d2b3338027f306cf79ef6bf6a3986ad5049d164 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -333,6 +333,12 @@ function user_search($keys) { return array(t("Matching users"), $find); } +function user_user($type, &$edit, &$user) { + if ($type == 'view') { + return array(t('History') => form_item(t('Member for'), format_interval(time() - $account->created))); + } +} + function user_block($op = "list", $delta = 0) { global $user; @@ -478,12 +484,12 @@ function theme_user_picture($account) { } } -function theme_user_profile($account) { +function theme_user_profile($account, $fields) { $output = "<div class=\"profile\">\n"; $output .= theme('user_picture', $account); - $output .= form_item(t('Name'), $account->name); - $output .= implode("\n", module_invoke_all('user', 'view', '', $account)); - $output .= form_item(t('Member for'), format_interval(time() - $account->created)); + foreach ($fields as $category => $value) { + $output .= "<h2>$category</h2>$value"; + } if (user_access("administer users")) { $output .= form_item(t("Administration"), l(t("edit account"), "admin/user/edit/$account->uid")); @@ -1077,7 +1083,16 @@ function user_view($uid = 0) { if ($uid == 0) { if ($user->uid) { - print theme('page', theme('user_profile', $user), $user->name); + // Retrieve and merge all profile fields: + $fields = array(); + foreach (module_list() as $module) { + if ($data = module_invoke($module, 'user', 'view', '', $user)) { + foreach ($data as $category => $content) { + $fields[$category] .= $content; + } + } + } + print theme('page', theme('user_profile', $user, $fields), $user->name); } else { $output = user_login(); @@ -1091,7 +1106,17 @@ function user_view($uid = 0) { } else { if ($account = user_load(array('uid' => $uid, "status" => 1))) { - print theme('page', theme('user_profile', $account), $account->name); + // Retrieve and merge all profile fields: + $fields = array(); + foreach (module_list() as $module) { + if ($data = module_invoke($module, 'user', 'view', '', $account)) { + foreach ($data as $category => $content) { + $fields[$category] .= $content; + } + } + } + + print theme('page', theme('user_profile', $account, $fields), $account->name); } else { drupal_not_found();