*
* @return boolean success flag
*/
- protected function prepare($args)
+ protected function prepare(array $args=array())
{
parent::prepare($args);
if (empty($profile)) {
// TRANS: Error message displayed when referring to a user without a profile.
$this->clientError(_('User has no profile.'));
- return;
}
$original = clone($profile);
- if (!empty($this->name)) {
- $profile->fullname = $this->name;
- }
-
- if (!empty($this->url)) {
- $profile->homepage = $this->url;
- }
-
- if (!empty($this->description)) {
- $profile->bio = $this->description;
- }
+ $profile->fullname = $this->name;
+ $profile->homepage = $this->url;
+ $profile->bio = $this->description;
+ $profile->location = $this->location;
if (!empty($this->location)) {
- $profile->location = $this->location;
-
- $loc = Location::fromName($location);
+ $loc = Location::fromName($this->location);
if (!empty($loc)) {
$profile->lat = $loc->lat;
$profile->location_id = $loc->location_id;
$profile->location_ns = $loc->location_ns;
}
+ } else {
+ // location is empty so reset the extrapolated information too
+ $profile->lat = '';
+ $profile->lon = '';
+ $profile->location_id = '';
+ $profile->location_ns = '';
}
$result = $profile->update($original);
common_log_db_error($profile, 'UPDATE', __FILE__);
// TRANS: Server error displayed if a user profile could not be saved.
$this->serverError(_('Could not save profile.'));
- return;
}
- common_broadcast_profile($profile);
-
$twitter_user = $this->twitterUserArray($profile, true);
if ($this->format == 'xml') {