Просмотр исходного кода

#4558 - Build-in API support (befriends)

roman.lesnikov@gmail.com 2 лет назад
Родитель
Сommit
138317a92c
1 измененных файлов с 7 добавлено и 3 удалено
  1. 7 3
      template/scripts/BxBaseServiceProfiles.php

+ 7 - 3
template/scripts/BxBaseServiceProfiles.php

@@ -152,10 +152,14 @@ class BxBaseServiceProfiles extends BxDol
     public function serviceBefriend ($iProfileId)
     {
         $oConnections = BxDolConnection::getObjectInstance('sys_profiles_friends'); 
-        $this->_oConnectionFriends->addConnection((int)bx_get_logged_profile_id(), $iProfileId);
-        $this->_oConnectionFriends->addConnection($iProfileId, (int)bx_get_logged_profile_id());
         $oProfile = BxDolProfile::getInstance($iProfileId);
-        return $oProfile->getUnitAPI($iProfileId);
+
+        if ($oProfile && $oConnections){
+            $oConnections->addConnection((int)bx_get_logged_profile_id(), $iProfileId);
+            $oConnections->addConnection($iProfileId, (int)bx_get_logged_profile_id());
+            $oProfile = BxDolProfile::getInstance($iProfileId);
+            return BxDolProfile::getData($iProfileId);
+        }
     }
 
     public function serviceProfileStats ($iProfileId = 0)