From 1a88d134b88a7bfb17b164bd03ace7aa3190b185 Mon Sep 17 00:00:00 2001 From: Neil Drumm <drumm@3064.no-reply.drupal.org> Date: Thu, 27 Jul 2006 07:46:31 +0000 Subject: [PATCH] #74395 by moshe, add hook_profile_alter() to let modules alter the profile page --- CHANGELOG.txt | 2 ++ modules/user/user.module | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 1d4142b094f6..560cd9a7182d 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 f9dcb4cc7029..5e70197231be 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); } -- GitLab