diff options
author | Mario Vavti <mario@mariovavti.com> | 2015-10-30 15:08:28 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2015-10-30 15:08:28 +0100 |
commit | d0b0d0ec727fea06cc1c129c53ef8965c9c0a7b4 (patch) | |
tree | cda663cb8765c265b19aa17c83d9b282643006a0 | |
parent | e0463f5a74ac56f19dd1159cb4ce2d3eff52dc90 (diff) | |
download | volse-hubzilla-d0b0d0ec727fea06cc1c129c53ef8965c9c0a7b4.tar.gz volse-hubzilla-d0b0d0ec727fea06cc1c129c53ef8965c9c0a7b4.tar.bz2 volse-hubzilla-d0b0d0ec727fea06cc1c129c53ef8965c9c0a7b4.zip |
possibly improve cloned profile images a bit - mod/photo would pick some random photos if there are more than one kind of PHOTO_PROFILE
-rw-r--r-- | include/zot.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/zot.php b/include/zot.php index 793eb6b39..73c7460d3 100644 --- a/include/zot.php +++ b/include/zot.php @@ -814,6 +814,28 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED, $ud_arr = null) { if ($local) { $ph = z_fetch_url($arr['photo'], true); if ($ph['success']) { + + // unless proven otherwise + $is_default_profile = 1; + + $profile = q("select is_default from profile where aid = %d and uid = %d limit 1", + intval($local[0]['channel_account_id']), + intval($local[0]['channel_id']) + ); + if($profile) { + if(! intval($profile[0]['is_default'])) + $is_default_profile = 0; + } + + if($is_default_profile) { + q("UPDATE photo SET photo_usage = %d WHERE photo_usage = %d AND aid = %d AND uid = %d", + intval(PHOTO_NORMAL), + intval(PHOTO_PROFILE), + intval($local[0]['channel_account_id']), + intval($local[0]['channel_id']) + ); + } + import_channel_photo($ph['body'], $arr['photo_mimetype'], $local[0]['channel_account_id'],$local[0]['channel_id']); // reset the names in case they got messed up when we had a bug in this function $photos = array( |