CMS솔루션마켓, 이온디 - 워드프레스, 라이믹스, 카페24, 그누보드, 엑셀

Contents Management System

방법1. sejin7940_write_limit - 일정기간 글/댓글 작성수 제한 애드온 ver. 1.5.2 (세진)

https://www.xpressengine.com/index.php?mid=download&package_id=19923002


방법2. 게시판 글 작성 수 제한 애드온 (웹지기)

https://xetown.com/point_contents/1085898

※ 댓글은 안됨.


방법3. 스킨 수정 (송동우/세진)

https://www.xpressengine.com/qna/21353763

https://www.xpressengine.com/qna/21738888


송동우님의 방법은 기존 모듈의 쿼리를 가져와서 카운트하는 것 같은데,

comment 모듈에서 getCommentCount 혹은

/www/modules/comment/queries/getCommentCount.xml

document 모듈에서 getDocumentCount 쿼리문을 봐도

/www/modules/document/queries/getDocumentCount.xml

로그인한 사용자의 댓글 갯수를 뽑아오는 쿼리문은 없었던 것 같았습니다.

logged_info 라는 쿼리문이 있으면 송동우님 방법대로 했겠지만 쓸 수 있는 쿼리문이 없어서,

세진님이 알려주신 직접 쿼리문을 짜서 가져오는 방법으로 해봤습니다.

{@
$oDB = &DB::getInstance();
$query_recomment = $oDB->_query('select count(*) as total from xe_comments where document_srl = '.$oComment->get('document_srl').' and user_id = "'.$logged_info->user_id.'"');
$result_recomment = $oDB->_fetch($query_recomment);

여기 빨간색 부분이 문제인 거 같아,  $oDocument->document_srl 로 변경해주었습니다.

<block cond="$mid=='event'">
   {@
   $oDB = &DB::getInstance();
   $query_recomment = $oDB->_query('select count(*) as total from xe_comments where document_srl = '.$oDocument->document_srl.' and user_id = "'.$logged_info->user_id.'"');
   $result_recomment = $oDB->_fetch($query_recomment);
   
   $args->member_srl = $logged_info->member_srl;
   $args->module_srl = $module_info->module_srl;
   $args->comment_count = $module_info->document_srl;
   //$output = executeQuery('document.getDocumentCount', $args);
   $output = executeQuery('document.getDocumentCount', $args);
   
   
   }
   
   {@ $commentModel = &getModel('comment')}
</block>
[0] <span cond="$commentModel->getCommentCount($oDocument->document_srl)">{$commentModel->getCommentCount($oDocument->document_srl)}</span>
<hr>
[1]{$result_recomment->total}
<hr>
[2]{count($output->data)}
<hr>
[3]{$output->data->count}
<hr>

{$result_recomment->total} 만 제대로 동작하는 소스입니다. ㅋ;


추천한 사람

 
댓글은 로그인 사용자만 작성 가능합니다. 로그인하기