X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=mod%2Fsettings.php;h=32906d86e7c9017e9b31d91a081da06a94740f37;hb=8257b1b684d2c6087a93ae690aa27c907e578aa3;hp=1923c58da1148d4f69742dd6df209fce410559b3;hpb=95ec0767d88efa7d8290db875b1c0f72542d9b68;p=friendica.git diff --git a/mod/settings.php b/mod/settings.php index 1923c58da1..32906d86e7 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -87,11 +87,14 @@ function settings_post(&$a) { $err = ''; + $name_change = false; + if($username != $a->user['username']) { - if(strlen($username) > 40) - $err .= t(' Please use a shorter name.'); - if(strlen($username) < 3) - $err .= t(' Name too short.'); + $name_change = true; + if(strlen($username) > 40) + $err .= t(' Please use a shorter name.'); + if(strlen($username) < 3) + $err .= t(' Name too short.'); } if($email != $a->user['email']) { @@ -165,6 +168,15 @@ function settings_post(&$a) { 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) { // Update global directory in background $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');