X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapiaccountupdateprofile.php;h=8767dabf8528a6ef23c597bb7b4a8de47903ba8a;hb=792b62874e13214dc12480acd2cf4a40b3292d79;hp=fea6064f30b7cbecf508a048424797049c0d879c;hpb=29d0871e5a5b2561387bcad40ef4644ee1c2be08;p=quix0rs-gnu-social.git diff --git a/actions/apiaccountupdateprofile.php b/actions/apiaccountupdateprofile.php index fea6064f30..8767dabf85 100644 --- a/actions/apiaccountupdateprofile.php +++ b/actions/apiaccountupdateprofile.php @@ -52,7 +52,7 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction * * @return boolean success flag */ - protected function prepare($args) + protected function prepare(array $args=array()) { parent::prepare($args); @@ -92,27 +92,17 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction 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; @@ -120,6 +110,12 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction $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); @@ -128,11 +124,8 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction 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') {