aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-01-24 18:18:47 -0800
committerFriendika <info@friendika.com>2011-01-24 18:18:47 -0800
commitf5674558caf888fc8bdbad5fbb6c9b54868c1bb3 (patch)
tree28b5e3f8dba545fe72ca23c95b341a4a74113c26
parent163e614a3bcac5365e9756ed88581689916c3cba (diff)
downloadvolse-hubzilla-f5674558caf888fc8bdbad5fbb6c9b54868c1bb3.tar.gz
volse-hubzilla-f5674558caf888fc8bdbad5fbb6c9b54868c1bb3.tar.bz2
volse-hubzilla-f5674558caf888fc8bdbad5fbb6c9b54868c1bb3.zip
propagate name changes to 'self' contact record
-rw-r--r--mod/settings.php20
1 files changed, 16 insertions, 4 deletions
diff --git a/mod/settings.php b/mod/settings.php
index 1923c58da..32906d86e 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');