propagate name changes to 'self' contact record

This commit is contained in:
Friendika 2011-01-24 18:18:47 -08:00
parent 163e614a3b
commit f5674558ca
1 changed files with 16 additions and 4 deletions

View File

@ -87,11 +87,14 @@ function settings_post(&$a) {
$err = ''; $err = '';
$name_change = false;
if($username != $a->user['username']) { if($username != $a->user['username']) {
if(strlen($username) > 40) $name_change = true;
$err .= t(' Please use a shorter name.'); if(strlen($username) > 40)
if(strlen($username) < 3) $err .= t(' Please use a shorter name.');
$err .= t(' Name too short.'); if(strlen($username) < 3)
$err .= t(' Name too short.');
} }
if($email != $a->user['email']) { if($email != $a->user['email']) {
@ -165,6 +168,15 @@ function settings_post(&$a) {
intval(local_user()) intval(local_user())
); );
if($name_change) {
q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `self` = 1 LIMIT 1",
dbesc($username),
dbesc(datetime_convert()),
intval(local_user())
);
}
if($old_visibility != $net_publish) { if($old_visibility != $net_publish) {
// Update global directory in background // Update global directory in background
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');