Improve conditions in api_account_update_profile

This commit is contained in:
Pierre Rudloff 2017-12-26 01:05:00 +01:00
parent de5dae0751
commit 94244024ac

View file

@ -4481,17 +4481,17 @@ api_register_func('api/account/update_profile_image', 'api_account_update_profil
*/
function api_account_update_profile($type)
{
$local_user = local_user();
$local_user = api_user();
$api_user = api_get_user(get_app());
if (x($_POST['name'])) {
if (!empty($_POST['name'])) {
dba::update('profile', ['name' => $_POST['name']], ['uid' => $local_user]);
dba::update('user', ['username' => $_POST['name']], ['uid' => $local_user]);
dba::update('contact', ['name' => $_POST['name']], ['uid' => $local_user, 'self' => 1]);
dba::update('contact', ['name' => $_POST['name']], ['id' => $api_user['id']]);
}
if (x($_POST['description'])) {
if (isset($_POST['description'])) {
dba::update('profile', ['about' => $_POST['description']], ['uid' => $local_user]);
dba::update('contact', ['about' => $_POST['description']], ['uid' => $local_user, 'self' => 1]);
dba::update('contact', ['about' => $_POST['description']], ['id' => $api_user['id']]);