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

#3998 - Minor fixes (allow to post comments)

roman.lesnikov@gmail.com 4 лет назад
Родитель
Сommit
5ee4dc274c
1 измененных файлов с 8 добавлено и 1 удалено
  1. 8 1
      template/scripts/BxBaseCmts.php

+ 8 - 1
template/scripts/BxBaseCmts.php

@@ -394,7 +394,7 @@ class BxBaseCmts extends BxDolCmts
         }
 
         $oProfileAuthor = BxDolProfile::getInstance($aCmt['cmt_author_id']);
-        if(($oProfileAuthor && $oProfileAuthor->isActive()) || isAdmin() || BxDolAcl::getInstance()->isMemberLevelInSet([MEMBERSHIP_ID_MODERATOR, MEMBERSHIP_ID_ADMINISTRATOR])) {
+        if($this->_isAllowShowComments($aCmt)) {
             $sContent = $this->_getContent($aCmt, $aBp, $aDp);
         }
         else {
@@ -722,6 +722,13 @@ class BxBaseCmts extends BxDolCmts
         return $this->_oQuery->getCommentsBy(array('type' => 'object_id', 'object_id' => $this->getId(), 'order_way' => 'desc', 'start' => $iCmtsStart, 'per_page' => $iCmtsLimit * 4));
     }
     
+    private function _isAllowShowComments($aCmt)
+    {
+        $oProfileAuthor = BxDolProfile::getInstance($aCmt['cmt_author_id']);
+        return ($oProfileAuthor && $oProfileAuthor->isActive()) || isAdmin() || BxDolAcl::getInstance()->isMemberLevelInSet([MEMBERSHIP_ID_MODERATOR, MEMBERSHIP_ID_ADMINISTRATOR]);
+          
+    }
+    
     public function getCounter($aParams = [])
     {
         $aParams = array_merge($this->_aElementDefaults, $aParams);