diff options
-rw-r--r-- | CHANGELOG.txt | 2 | ||||
-rw-r--r-- | modules/user/user.module | 15 |
2 files changed, 14 insertions, 3 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 1d4142b09..560cd9a71 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -27,6 +27,8 @@ Drupal x.x.x, xxxx-xx-xx (development version) * added db_table_exists(). - blogapi module: * 'blogapi new' and 'blogapi edit' nodeapi operations. +- user module: + * added hook_profile_alter(). Drupal 4.7.0, 2006-05-01 ------------------------ diff --git a/modules/user/user.module b/modules/user/user.module index f9dcb4cc7..5e7019723 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -445,7 +445,7 @@ function user_search($op = 'search', $keys = NULL) { */ function user_user($type, &$edit, &$user, $category = NULL) { if ($type == 'view') { - $items[] = array('title' => t('Member for'), + $items['history'] = array('title' => t('Member for'), 'value' => format_interval(time() - $user->created), 'class' => 'member', ); @@ -1428,13 +1428,22 @@ function user_view($uid = 0) { foreach (module_list() as $module) { if ($data = module_invoke($module, 'user', 'view', '', $account)) { foreach ($data as $category => $items) { - foreach ($items as $item) { + foreach ($items as $key => $item) { $item['class'] = "$module-". $item['class']; - $fields[$category][] = $item; + $fields[$category][$key] = $item; } } } } + + // Let modules change the returned fields - useful for personal privacy + // controls. Since modules communicate changes by reference, we cannot use + // module_invoke_all(). + foreach (module_implements('profile_alter') as $module) { + $function = $module .'_profile_alter'; + $function($account, $fields); + } + drupal_set_title($account->name); return theme('user_profile', $account, $fields); } |