/** * Privacy Profile. * * @param object \PH7\UserModel $oUserModel * @return void */ private function _initPrivacy(UserModel $oUserModel) { // Check Privacy Profile $oPrivacyViewsUser = $oUserModel->getPrivacySetting($this->iProfileId); if ($oPrivacyViewsUser->searchProfile == 'no') { // Exclude profile of search engines $this->view->header = '<meta name="robots" content="noindex" />'; } if (!$this->sUserAuth && $oPrivacyViewsUser->privacyProfile == 'only_members') { $this->view->error = t('Whoops! The "%0%" profile is only visible to members. Please <a href="%1%">login</a> or <a href="%2%">register</a> to see this profile.', $this->sUsername, Uri::get('user', 'main', 'login'), Uri::get('user', 'signup', 'step1')); } elseif ($oPrivacyViewsUser->privacyProfile == 'only_me' && !$this->str->equals($this->iProfileId, $this->iVisitorId)) { $this->view->error = t('Whoops! The "%0%" profile is not available to you.', $this->sUsername); } // Update the "Who's Viewed Your Profile" if ($this->sUserAuth) { $oPrivacyViewsVisitor = $oUserModel->getPrivacySetting($this->iVisitorId); if ($oPrivacyViewsUser->userSaveViews == 'yes' && $oPrivacyViewsVisitor->userSaveViews == 'yes' && !$this->str->equals($this->iProfileId, $this->iVisitorId)) { $oVisitorModel = new VisitorModel($this->iProfileId, $this->iVisitorId, $this->dateTime->get()->dateTime('Y-m-d H:i:s')); if (!$oVisitorModel->already()) { // Add a new visit $oVisitorModel->set(); } else { // Update the date of last visit $oVisitorModel->update(); } unset($oVisitorModel); } } unset($oPrivacyViewsUser, $oPrivacyViewsVisitor); }