aboutsummaryrefslogtreecommitdiffstats
path: root/mod/profiles.php
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-08-08 21:03:08 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-08-08 21:03:08 -0700
commitd11c1c63c02e88b3c73336741a2240ccc18d3b02 (patch)
treeaf32bf9355c99c578f696aec91f66374acd82208 /mod/profiles.php
parent0bcd5522315649c8d4652b8bfaa9bec328b9d548 (diff)
downloadvolse-hubzilla-d11c1c63c02e88b3c73336741a2240ccc18d3b02.tar.gz
volse-hubzilla-d11c1c63c02e88b3c73336741a2240ccc18d3b02.tar.bz2
volse-hubzilla-d11c1c63c02e88b3c73336741a2240ccc18d3b02.zip
lots of fixes - most recent photo updates for contacts
Diffstat (limited to 'mod/profiles.php')
-rw-r--r--mod/profiles.php20
1 files changed, 16 insertions, 4 deletions
diff --git a/mod/profiles.php b/mod/profiles.php
index db4426474..bfdff5f6b 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -7,16 +7,19 @@ function profiles_post(&$a) {
notice( "Permission denied." . EOL);
return;
}
+
+ $namechanged = false;
+
if(($a->argc > 1) && ($a->argv[1] != "new") && intval($a->argv[1])) {
- $r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ $orig = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($a->argv[1]),
intval($_SESSION['uid'])
);
- if(! count($r)) {
+ if(! count($orig)) {
$_SESSION['sysmsg'] .= "Profile not found." . EOL;
return;
}
- $is_default = (($r[0]['is-default']) ? 1 : 0);
+ $is_default = (($orig[0]['is-default']) ? 1 : 0);
$profile_name = notags(trim($_POST['profile_name']));
if(! strlen($profile_name)) {
@@ -39,6 +42,10 @@ function profiles_post(&$a) {
$name = notags(trim($_POST['name']));
+
+ if($orig[0]['name'] != $name)
+ $namechanged = true;
+
$gender = notags(trim($_POST['gender']));
$address = notags(trim($_POST['address']));
$locality = notags(trim($_POST['locality']));
@@ -132,7 +139,12 @@ function profiles_post(&$a) {
);
}
-
+ if($namechanged && $is_default) {
+ $r = q("UPDATE `contact` SET `name-date` = '%s' WHERE `self` = 1 AND `uid` = %d LIMIT 1",
+ dbesc(datetime_convert()),
+ intval($_SESSION['uid'])
+ );
+ }
}