Пример #1
0
 public static function getListingsInfoByUserSID($user_sid, $subuser = false)
 {
     $listings_sid = SJB_ListingDBManager::getListingsSIDByUserSID($user_sid, $subuser);
     $listings = array();
     foreach ($listings_sid as $listing_sid) {
         $listings[] = SJB_ListingManager::getListingInfoBySID($listing_sid);
     }
     return $listings;
 }
Пример #2
0
 public static function deleteUserById($id)
 {
     $user = SJB_UserManager::getObjectBySID($id);
     if (empty($user)) {
         SJB_UserDBManager::deleteEmptyUsers();
         return true;
     }
     SJB_Event::dispatch('onBeforeUserDelete', $user);
     $listings = SJB_ListingDBManager::getListingsSIDByUserSID($id);
     SJB_ListingManager::deleteListingBySID($listings);
     $subusers = self::getSubusers($id);
     foreach ($subusers as $subuser) {
         self::deleteUserById($subuser['sid']);
     }
     // delete user logo file
     $pictProp = $user->getProperty('Logo');
     if ($pictProp) {
         SJB_UploadFileManager::deleteUploadedFileByID($pictProp->value);
     }
     $videoProp = $user->getProperty('video');
     if ($videoProp) {
         SJB_UploadFileManager::deleteUploadedFileByID($videoProp->value);
     }
     // delete social info
     $socialReference = SJB_SocialPlugin::getProfileSocialID($user->getSID());
     if ($socialReference) {
         SJB_SocialPlugin::deleteProfileSocialInfoByReference($socialReference);
     }
     $result = SJB_UserDBManager::deleteUserById($id) && SJB_ContractManager::deleteAllContractsByUserSID($id) && SJB_Rating::deleteRatingByUserSID($id);
     SJB_Cache::getInstance()->clean('matchingAnyTag', array(SJB_Cache::TAG_USERS));
     return $result && SJB_SavedSearches::deleteUserSearchesFromDB($id);
 }