Do not require validation for private names modifications (Closes #1389).
authorStéphane Jacob <sj@m4x.org>
Mon, 28 Feb 2011 10:27:25 +0000 (11:27 +0100)
committerStéphane Jacob <sj@m4x.org>
Mon, 28 Feb 2011 10:27:25 +0000 (11:27 +0100)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
ChangeLog
include/name.func.inc.php

index 4e44b04..23d1cb8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -35,6 +35,7 @@ Bug/Wish:
         - #1367: Improves postal address formatting                        -JAC
         - #1368: Allows admin profile edition even if birthdate is unknown -JAC
         - #1369: Properly displays moderated jobs                          -JAC
+        - #1389: Do not require validation for private names modifications -JAC
         - #1401: Main addresses are displayed before secondary addresses   -JAC
 
     * Register:
index d3d11a2..09f8b71 100644 (file)
@@ -251,13 +251,18 @@ 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['pub']) && !is_null($sn['fullname'])) {
             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 ($sn['fullname'] == $sn_old[$typeid]['fullname'] && $sn['name'] == $sn_old[$typeid]['name']) {
+                XDB::execute('INSERT INTO  profile_name (particle, name, typeid, pid)
+                                   VALUES  ({?}, {?}, {?}, {?})',
+                             $sn_old[$typeid]['particle'], $sn_old[$typeid]['name'], $typeid, $pid);
+                unset($sn_old[$typeid]);
             } else {
                 $has_new = true;
             }