From 3ec8ae8ea229f68d2ec8ba9f3ada0a1e05d17f1a Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Mon, 6 Dec 2010 21:30:25 +0100 Subject: [PATCH] Allows secretaries and admin to fully edit profiles' names (Closes #1340). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- include/name.func.inc.php | 8 +------- modules/profile/general.inc.php | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/include/name.func.inc.php b/include/name.func.inc.php index b23fdff..7fd7623 100644 --- a/include/name.func.inc.php +++ b/include/name.func.inc.php @@ -252,18 +252,12 @@ function set_alias_names(&$sn_new, $sn_old, $pid, $uid, $update_new = false, $ne $has_new = false; foreach ($sn_new as $typeid => $sn) { if (isset($sn['pub'])) { - if (isset($sn_old[$typeid]) && ($sn_old[$typeid]['fullname'] == $sn['fullname'] && $update_new)) { + if (isset($sn_old[$typeid]) && $update_new) { XDB::execute("UPDATE profile_name SET particle = {?}, name = {?}, typeid = {?} WHERE id = {?} AND pid = {?}", $sn['particle'], $sn['name'], $typeid, $sn_old[$typeid]['id'], $pid); unset($sn_old[$typeid]); - } elseif ($update_new - || (isset($sn_old[$typeid]) && compare_basename($sn_old[$typeid]['fullname'], $sn['fullname']))) { - XDB::execute("INSERT INTO profile_name (particle, name, typeid, pid) - VALUES ({?}, {?}, {?}, {?})", - $sn['particle'], $sn['name'], $typeid, $pid); - unset($sn_old[$typeid]); } else { $has_new = true; } diff --git a/modules/profile/general.inc.php b/modules/profile/general.inc.php index a98acac..ac797c6 100644 --- a/modules/profile/general.inc.php +++ b/modules/profile/general.inc.php @@ -149,7 +149,7 @@ class ProfileSettingSearchNames implements ProfileSetting $this->search_names = array(); foreach ($value as &$sn) { $sn['name'] = trim($sn['name']); - if ($sn['type'] == 'firstname' || $sn['type'] == 'lastname') { + if (S::user()->isMe($this->owner) && ($sn['type'] == 'firstname' || $sn['type'] == 'lastname')) { $sn['name'] = $this->prepare($page, $sn['type'], $sn['name'], $initial[$sn['type']], $success_tmp); $success = $success && $success_tmp; -- 2.1.4