]> git.mxchange.org Git - friendica.git/commitdiff
Set profile fields for system user in Model\User::getOwnerDataById
authorHypolite Petovan <hypolite@mrpetovan.com>
Mon, 23 Aug 2021 18:07:32 +0000 (14:07 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Tue, 24 Aug 2021 09:53:46 +0000 (05:53 -0400)
- Address https://github.com/friendica/friendica/issues/10473#issuecomment-903676606
- This is required when Model\Profile::load is called for the system user for example

src/Model/User.php
src/Module/Profile/Contacts.php

index 49423ce9ef74792b17423aabd52380ef7ec5006e..5af5f7f58266b414622b67c1ec280f72ff95f8d5 100644 (file)
@@ -149,14 +149,20 @@ class User
                $system['page-flags'] = User::PAGE_FLAGS_SOAPBOX;
                $system['account-type'] = $system['contact-type'];
                $system['guid'] = '';
-               $system['nickname'] = $system['nick'];
-               $system['pubkey'] = $system['pubkey'];
+               $system['picdate'] = '';
+               $system['theme'] = '';
+               $system['publish'] = false;
+               $system['net-publish'] = false;
+               $system['hide-friends'] = true;
+               $system['prv_keywords'] = '';
+               $system['pub_keywords'] = '';
+               $system['address'] = '';
                $system['locality'] = '';
                $system['region'] = '';
+               $system['postal-code'] = '';
                $system['country-name'] = '';
-               $system['net-publish'] = false;
-               $system['picdate'] = '';
-               $system['theme'] = '';
+               $system['homepage'] = DI::baseUrl()->get();
+               $system['dob'] = '0000-00-00';
 
                // Ensure that the user contains data
                $user = DBA::selectFirst('user', ['prvkey', 'guid'], ['uid' => 0]);
index 19dbe4cddb3909d087c7d7f33298748420fefe04..94f301557b57c7f9bd0eea81bc7c514f65673f3f 100644 (file)
@@ -52,7 +52,7 @@ class Contacts extends Module\BaseProfile
 
                $is_owner = $profile['uid'] == local_user();
 
-               if (!empty($profile['hide-friends']) && !$is_owner) {
+               if ($profile['hide-friends'] && !$is_owner) {
                        throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
                }