$pub_keywords = notags(trim($_POST['pub_keywords']));
$prv_keywords = notags(trim($_POST['prv_keywords']));
$marital = notags(trim($_POST['marital']));
+ $howlong = notags(trim($_POST['howlong']));
$with = ((x($_POST,'with')) ? notags(trim($_POST['with'])) : '');
+ if(! strlen($howlong))
+ $howlong = '0000-00-00 00:00:00';
+ else
+ $howlong = datetime_convert(date_default_timezone_get(),'UTC',$howlong);
+
// linkify the relationship target if applicable
$withchanged = false;
$sexual = notags(trim($_POST['sexual']));
$homepage = notags(trim($_POST['homepage']));
+ $hometown = notags(trim($_POST['hometown']));
$politic = notags(trim($_POST['politic']));
$religion = notags(trim($_POST['religion']));
$changes = array();
+ $value = '';
if($is_default) {
- if($marital != $orig[0]['marital']) $changes[] = '♥ ' . t('Marital Status');
- if($withchanged) $changes[] = '♥ ' . t('Romantic Partner');
- if($work != $orig[0]['work']) $changes[] = t('Work/Employment');
- if($religion != $orig[0]['religion']) $changes[] = t('Religion');
- if($politic != $orig[0]['politic']) $changes[] = t('Political Views');
- if($gender != $orig[0]['gender']) $changes[] = t('Gender');
- if($sexual != $orig[0]['sexual']) $changes[] = t('Sexual Preference');
- if($homepage != $orig[0]['homepage']) $changes[] = t('Homepage');
- if($interest != $orig[0]['interest']) $changes[] = t('Interests');
- if($address != $orig[0]['address'] || $locality != $orig[0]['locality'] || $region != $orig[0]['region']
- || $country_name != $orig[0]['country_name'])
- $changes[] = t('Location');
-
- profile_activity($changes);
+ if($marital != $orig[0]['marital']) {
+ $changes[] = '[color=#ff0000]♥[/color] ' . t('Marital Status');
+ $value = $marital;
+ }
+ if($withchanged) {
+ $changes[] = '[color=#ff0000]♥[/color] ' . t('Romantic Partner');
+ $value = strip_tags($with);
+ }
+ if($work != $orig[0]['work']) {
+ $changes[] = t('Work/Employment');
+ }
+ if($religion != $orig[0]['religion']) {
+ $changes[] = t('Religion');
+ $value = $religion;
+ }
+ if($politic != $orig[0]['politic']) {
+ $changes[] = t('Political Views');
+ $value = $politic;
+ }
+ if($gender != $orig[0]['gender']) {
+ $changes[] = t('Gender');
+ $value = $gender;
+ }
+ if($sexual != $orig[0]['sexual']) {
+ $changes[] = t('Sexual Preference');
+ $value = $sexual;
+ }
+ if($homepage != $orig[0]['homepage']) {
+ $changes[] = t('Homepage');
+ $value = $homepage;
+ }
+ if($interest != $orig[0]['interest']) {
+ $changes[] = t('Interests');
+ $value = $interest;
+ }
+ if($address != $orig[0]['address']) {
+ $changes[] = t('Address');
+ // New address not sent in notifications, potential privacy issues
+ // in case this leaks to unintended recipients. Yes, it's in the public
+ // profile but that doesn't mean we have to broadcast it to everybody.
+ }
+ if($locality != $orig[0]['locality'] || $region != $orig[0]['region']
+ || $country_name != $orig[0]['country-name']) {
+ $changes[] = t('Location');
+ $comma1 = ((($locality) && ($region || $country_name)) ? ', ' : ' ');
+ $comma2 = (($region && $country_name) ? ', ' : '');
+ $value = $locality . $comma1 . $region . $comma2 . $country_name;
+ }
+
+ profile_activity($changes,$value);
}
`country-name` = '%s',
`marital` = '%s',
`with` = '%s',
+ `howlong` = '%s',
`sexual` = '%s',
`homepage` = '%s',
+ `hometown` = '%s',
`politic` = '%s',
`religion` = '%s',
`pub_keywords` = '%s',
dbesc($country_name),
dbesc($marital),
dbesc($with),
+ dbesc($howlong),
dbesc($sexual),
dbesc($homepage),
+ dbesc($hometown),
dbesc($politic),
dbesc($religion),
dbesc($pub_keywords),
}
-function profile_activity($changed) {
+function profile_activity($changed, $value) {
$a = get_app();
if(! local_user() || ! is_array($changed) || ! count($changed))
foreach($changed as $ch) {
if(strlen($changes)) {
if ($z == ($t - 1))
- $changes .= ' and ';
+ $changes .= t(' and ');
else
$changes .= ', ';
}
$prof = '[url=' . $self[0]['url'] . '?tab=profile' . ']' . t('public profile') . '[/url]';
- $arr['body'] = sprintf( t('%1$s has an updated %2$s, changing %3$s.'), $A, $prof, $changes);
+ if($t == 1 && strlen($value)) {
+ $message = sprintf( t('%1$s changed %2$s to “%3$s”'), $A, $changes, $value);
+ $message .= "\n\n" . sprintf( t(' - Visit %1$s\'s %2$s'), $A, $prof);
+ }
+ else
+ $message = sprintf( t('%1$s has an updated %2$s, changing %3$s.'), $A, $prof, $changes);
+
+
+ $arr['body'] = $message;
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_PROFILE . '</type><title>' . $self[0]['name'] . '</title>'
. '<id>' . $self[0]['url'] . '/' . $self[0]['name'] . '</id>';
'$lbl_marital' => t('<span class="heart">♥</span> Marital Status:'),
'$lbl_with' => t("Who: \x28if applicable\x29"),
'$lbl_ex1' => t('Examples: cathy123, Cathy Williams, cathy@example.com'),
+ '$lbl_howlong' => t('Since [date]:'),
'$lbl_sexual' => t('Sexual Preference:'),
'$lbl_homepage' => t('Homepage URL:'),
+ '$lbl_hometown' => t('Hometown:'),
'$lbl_politic' => t('Political Views:'),
'$lbl_religion' => t('Religious Views:'),
'$lbl_pubkey' => t('Public Keywords:'),
'$gender' => gender_selector($r[0]['gender']),
'$marital' => marital_selector($r[0]['marital']),
'$with' => strip_tags($r[0]['with']),
+ '$howlong' => ($r[0]['howlong'] === '0000-00-00 00:00:00' ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong'])),
'$sexual' => sexpref_selector($r[0]['sexual']),
'$about' => $r[0]['about'],
'$homepage' => $r[0]['homepage'],
+ '$hometown' => $r[0]['hometown'],
'$politic' => $r[0]['politic'],
'$religion' => $r[0]['religion'],
'$pub_keywords' => $r[0]['pub_keywords'],
}
else {
- $r = q("SELECT * FROM `profile` WHERE `uid` = %d",
+ $r = q("SELECT `profile`.*, `contact`.`avatar-date` AS picdate FROM `profile` LEFT JOIN `contact` on `contact`.`uid` = `profile`.`uid` WHERE `profile`.`uid` = %d and contact.self = 1",
local_user());
if(count($r)) {
foreach($r as $rr) {
$o .= replace_macros($tpl, array(
- '$photo' => $rr['thumb'],
+ '$photo' => $rr['thumb'] . '?rev=' . urlencode($rr['picdate']),
'$id' => $rr['id'],
'$alt' => t('Profile Image'),
'$profile_name' => $rr['profile-name'],