diff options
author | redmatrix <git@macgirvin.com> | 2016-01-20 23:16:12 -0800 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-01-20 23:16:12 -0800 |
commit | 1d891984441fa2f4aa8e311191da23e9ddd6e928 (patch) | |
tree | 0a558e33ed4b77a56186721cf13844ba7b28af24 /include | |
parent | 8c5d5b8e1c1bda6281af4cc291e3e391d590a9ce (diff) | |
download | volse-hubzilla-1d891984441fa2f4aa8e311191da23e9ddd6e928.tar.gz volse-hubzilla-1d891984441fa2f4aa8e311191da23e9ddd6e928.tar.bz2 volse-hubzilla-1d891984441fa2f4aa8e311191da23e9ddd6e928.zip |
issue #263 - account_default_channel not set to 0 when last channel of an account is removed
Diffstat (limited to 'include')
-rw-r--r-- | include/Contact.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/Contact.php b/include/Contact.php index 3bd5f9936..611371db6 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -331,6 +331,7 @@ function channel_remove($channel_id, $local = true, $unset_session=true) { dbesc(datetime_convert()), intval($channel_id) ); + // if this was the default channel, set another one as default if($a->account['account_default_channel'] == $channel_id) { $r = q("select channel_id from channel where channel_account_id = %d and channel_removed = 0 limit 1", @@ -344,12 +345,11 @@ function channel_remove($channel_id, $local = true, $unset_session=true) { } else { $rr = q("update account set account_default_channel = 0 where account_id = %d", - intval($r[0]['channel_id']), - intval($a->account['account_id'])); + intval($a->account['account_id']) + ); } } - logger('deleting hublocs',LOGGER_DEBUG); $r = q("update hubloc set hubloc_deleted = 1 where hubloc_hash = '%s' and hubloc_url = '%s' ", |