Use the particle as name if name is empty
authorPascal Corpet <pascal.corpet@m4x.org>
Sun, 6 Jun 2010 13:43:12 +0000 (15:43 +0200)
committerPascal Corpet <pascal.corpet@m4x.org>
Sun, 6 Jun 2010 13:43:12 +0000 (15:43 +0200)
modules/profile/general.inc.php

index 5ba5a8f..6967a38 100644 (file)
@@ -153,11 +153,18 @@ class ProfileSettingSearchNames implements ProfileSetting
                 }
                 if ($sn['pub']) {
                     if (isset($sn['particle']) && ($sn['particle'] != '')) {
+                        // particle is before first blank
                         list($particle, $name) = explode(' ', $sn['name'], 2);
                         $particle = trim($particle) . ' ';
                         if (!$name) {
+                            // particle is before first quote
                             list($particle, $name) = explode('\'', $sn['name'], 2);
                             $particle = trim($particle);
+                            if (!$name) {
+                                // actually there is no particle
+                                $particle = '';
+                                $name = $sn['name'];
+                            }
                         }
                     } else {
                         $particle = '';