Allows secretaries and admin to fully edit profiles' names (Closes #1340).
authorStéphane Jacob <sj@m4x.org>
Mon, 6 Dec 2010 20:30:25 +0000 (21:30 +0100)
committerStéphane Jacob <sj@m4x.org>
Mon, 6 Dec 2010 20:38:31 +0000 (21:38 +0100)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
include/name.func.inc.php
modules/profile/general.inc.php

index b23fdff..7fd7623 100644 (file)
@@ -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;
             }
index a98acac..ac797c6 100644 (file)
@@ -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;