Add link to the administration page of the account, use category instead
[platal.git] / include / name.func.inc.php
index 272f1e4..d954263 100644 (file)
@@ -189,7 +189,7 @@ function build_sort_name(&$search_names, &$sn_types)
     return $name;
 }
 
-function set_profile_display(&$display_names, $pid)
+function set_profile_display(&$display_names, Profile $profile)
 {
     XDB::execute("UPDATE  profile_display
                      SET  public_name = {?}, private_name = {?},
@@ -197,16 +197,14 @@ function set_profile_display(&$display_names, $pid)
                    WHERE  pid = {?}",
                  $display_names['public_name'], $display_names['private_name'],
                  $display_names['directory_name'], $display_names['short_name'],
-                 $display_names['sort_name'], $pid);
+                 $display_names['sort_name'], $profile->id());
 
-    /* XXX: Inefficient, should directly take the profile as parameter */
-    $profile = Profile::get($pid);
     $owner = $profile->owner();
     if ($owner) {
         XDB::execute('UPDATE  accounts
-                         SET  full_name = {?}
+                         SET  full_name = {?}, directory_name = {?}
                        WHERE  uid = {?}',
-                     $display_names['public_name'], $owner->id());
+                     $display_names['public_name'], $display_names['directory_name'], $owner->id());
     }
 }