update location while saving new profile
This commit is contained in:
parent
943b2bea09
commit
967de94665
@ -306,6 +306,16 @@ class ProfilesettingsAction extends AccountSettingsAction
|
|||||||
$profile->homepage = $homepage;
|
$profile->homepage = $homepage;
|
||||||
$profile->bio = $bio;
|
$profile->bio = $bio;
|
||||||
$profile->location = $location;
|
$profile->location = $location;
|
||||||
|
|
||||||
|
$loc = Location::fromName($location);
|
||||||
|
|
||||||
|
if (!empty($loc)) {
|
||||||
|
$profile->lat = $loc->lat;
|
||||||
|
$profile->lon = $loc->lon;
|
||||||
|
$profile->location_id = $loc->location_id;
|
||||||
|
$profile->location_ns = $loc->location_ns;
|
||||||
|
}
|
||||||
|
|
||||||
$profile->profileurl = common_profile_url($nickname);
|
$profile->profileurl = common_profile_url($nickname);
|
||||||
|
|
||||||
common_debug('Old profile: ' . common_log_objstring($orig_profile), __FILE__);
|
common_debug('Old profile: ' . common_log_objstring($orig_profile), __FILE__);
|
||||||
|
@ -168,7 +168,8 @@ class Notice extends Memcached_DataObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
static function saveNew($profile_id, $content, $source=null,
|
static function saveNew($profile_id, $content, $source=null,
|
||||||
$is_local=Notice::LOCAL_PUBLIC, $reply_to=null, $uri=null, $created=null) {
|
$is_local=Notice::LOCAL_PUBLIC, $reply_to=null, $uri=null, $created=null,
|
||||||
|
$lat=null, $lon=null, $location_id=null, $location_ns=null) {
|
||||||
|
|
||||||
$profile = Profile::staticGet($profile_id);
|
$profile = Profile::staticGet($profile_id);
|
||||||
|
|
||||||
@ -234,6 +235,26 @@ class Notice extends Memcached_DataObject
|
|||||||
$notice->conversation = $reply->conversation;
|
$notice->conversation = $reply->conversation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($lat) && !empty($lon)) {
|
||||||
|
$notice->lat = $lat;
|
||||||
|
$notice->lon = $lon;
|
||||||
|
$notice->location_id = $location_id;
|
||||||
|
$notice->location_ns = $location_ns;
|
||||||
|
} else if (!empty($location_ns) && !empty($location_id)) {
|
||||||
|
$location = Location::fromId($location_id, $location_ns);
|
||||||
|
if (!empty($location)) {
|
||||||
|
$notice->lat = $location->lat;
|
||||||
|
$notice->lon = $location->lon;
|
||||||
|
$notice->location_id = $location_id;
|
||||||
|
$notice->location_ns = $location_ns;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$notice->lat = $profile->lat;
|
||||||
|
$notice->lon = $profile->lon;
|
||||||
|
$notice->location_id = $profile->location_id;
|
||||||
|
$notice->location_ns = $profile->location_ns;
|
||||||
|
}
|
||||||
|
|
||||||
if (Event::handle('StartNoticeSave', array(&$notice))) {
|
if (Event::handle('StartNoticeSave', array(&$notice))) {
|
||||||
|
|
||||||
// XXX: some of these functions write to the DB
|
// XXX: some of these functions write to the DB
|
||||||
|
Loading…
Reference in New Issue
Block a user