Przeglądaj źródła

#4558 - Build-in API support online info

romanlesnikov 1 rok temu
rodzic
commit
b729fe217b

+ 1 - 0
modules/base/profile/classes/BxBaseModProfileModule.php

@@ -2294,6 +2294,7 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolCon
         if(getParam('sys_api_conn_in_prof_units') == 'on' && $oProfile !== false) {
             $iProfileId = $oProfile->id();
             $aResult['title'] = $oProfile->getDisplayName();
+            $aResult['online'] = $oProfile->isOnline();
             if(($oConnection = BxDolConnection::getObjectInstance('sys_profiles_friends')) !== false && isset($CNF['URI_VIEW_FRIENDS'])) {
                 $aResult['friends_count'] = $oConnection->getConnectedContentCount($iProfileId, true);
                 $aResult['friends_list'] = $oConnection->getConnectedListAPI($iProfileId, true, BX_CONNECTIONS_CONTENT_TYPE_CONTENT);

+ 3 - 2
template/scripts/BxBasePage.php

@@ -568,7 +568,8 @@ class BxBasePage extends BxDolPage
                         'get_avatar' => 'getAvatarBig',
                         'with_info' => true
                     ]);
-                    
+                    $oProfile = BxDolProfile::getInstance($this->_aProfileInfo['id']);
+                    $aProfileInfo['online'] = $oProfile->isOnline();
                     unset($aProfileInfo['info']['profile_email']);
                     unset($aProfileInfo['info']['profile_last_active']);
                     unset($aProfileInfo['info']['profile_ip']);
@@ -577,7 +578,7 @@ class BxBasePage extends BxDolPage
                         'profile' => $aProfileInfo,
                         'actions_menu' => '',
                         'meta_menu' => '',
-                        'badges' => BxDolProfile::getInstance($this->_aProfileInfo['id'])->getBadges(),
+                        'badges' => $oProfile->getBadges(),
                         'cover' => $oProfileModule->serviceGetCover($this->_aProfileInfo['content_id']),
                         'allow_edit' =>  $oProfileModule->checkAllowedChangeCover($aProfileContentInfo) === CHECK_ACTION_RESULT_ALLOWED
                     ];