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

#1 - Add "Login or Join to comment".

AntonLV 11 лет назад
Родитель
Сommit
10ae571895

+ 1 - 0
modules/boonex/english/data/langs/system/en.xml

@@ -1299,6 +1299,7 @@
 	<string name="_cmt_display_flat"><![CDATA[Flat]]></string>
 	<string name="_cmt_display_threaded"><![CDATA[Threaded]]></string>
 	<string name="_cmt_err_cannot_perform_action"><![CDATA[Cannot perform action. Please report.]]></string>
+	<string name="_cmt_msg_login_required"><![CDATA[<a href="{0}">Login</a> or <a href="{1}">Join</a> to comment.]]></string>
 	<string name="_cmt_page_view_header"><![CDATA[Comment to {0}]]></string>
 	<string name="_cmt_page_view_title"><![CDATA[Comment to <a href="{0}">{1}</a>]]></string>
 	<string name="_cmt_view_attached_image"><![CDATA[View image]]></string>

+ 1 - 0
modules/boonex/russian/data/langs/system/ru.xml

@@ -1299,6 +1299,7 @@
 	<string name="_cmt_display_flat"><![CDATA[Целиком]]></string>
 	<string name="_cmt_display_threaded"><![CDATA[Поэтапно]]></string>
 	<string name="_cmt_err_cannot_perform_action"><![CDATA[Невозможно выполнить действие. Пожалуйста, оповестите нас об этой проблеме.]]></string>
+	<string name="_cmt_msg_login_required"><![CDATA[Чтобы оставить комментарий, вам необходимо <a href="{0}">войти</a> или <a href="{1}">зарегистрироваться</a>.]]></string>
 	<string name="_cmt_page_view_header"><![CDATA[Комментировать {0}]]></string>
 	<string name="_cmt_page_view_title"><![CDATA[Комментировать <a href="{0}">{1}</a>]]></string>
 	<string name="_cmt_view_attached_image"><![CDATA[Просмотреть изображение]]></string>

+ 7 - 1
template/scripts/BxBaseCmts.php

@@ -119,8 +119,14 @@ class BxBaseCmts extends BxDolCmts
         $this->_prepareParams($aBp, $aDp);
 
         $aCmts = $this->getCommentsArray($aBp['vparent_id'], $aBp['filter'], $aBp['order'], $aBp['start'], $aBp['per_view']);
-        if(empty($aCmts) || !is_array($aCmts))
+        if(empty($aCmts) || !is_array($aCmts)) {
+        	if((int)$aBp['parent_id'] == 0 && !isLogged())	{
+        		$oPermalink = BxDolPermalinks::getInstance();
+        		return MsgBox(_t('_cmt_msg_login_required', $oPermalink->permalink('page.php?i=login'), $oPermalink->permalink('page.php?i=create-account')));
+        	}
+
             return isset($aDp['show_empty']) && $aDp['show_empty'] === true ? $this->_getEmpty() : '';
+        }
 
         $sCmts = '';
         foreach($aCmts as $k => $aCmt)