Skip to content

Commit

Permalink
게시글의 답글 개수를 반환하는 코드 개선
Browse files Browse the repository at this point in the history
  • Loading branch information
lchcosmosfarm committed Nov 9, 2020
1 parent c4335f8 commit 7ffe8a0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
15 changes: 13 additions & 2 deletions plugins/kboard/class/KBContent.class.php
Expand Up @@ -1137,14 +1137,25 @@ public function getCommentsCountOld($prefix='(', $endfix=')'){
}

/**
* 게시글의 답글 개수를 반환하나.
* 게시글의 답글 개수를 반환한다.
* @param string $format
* @return string
*/
public function getReplyCount($format='(%s)'){
global $wpdb;
if($this->uid){
$count = $wpdb->get_var("SELECT COUNT(*) FROM `{$wpdb->prefix}kboard_board_content` WHERE `parent_uid`='$this->uid'");
$where = array();
$where[] = "`parent_uid`='{$this->uid}'";

// 휴지통에 없는 게시글만 불러온다.
$get_list_status_query = kboard_get_list_status_query($this->board_id, "{$wpdb->prefix}kboard_board_content");
if($get_list_status_query){
$where[] = $get_list_status_query;
}

$where = implode(' AND ', $where);

$count = $wpdb->get_var("SELECT COUNT(*) FROM `{$wpdb->prefix}kboard_board_content` WHERE {$where}");
if($count){
return sprintf($format, $count);
}
Expand Down
3 changes: 2 additions & 1 deletion plugins/kboard/history.md
Expand Up @@ -12,7 +12,8 @@
5. 첨부파일 다운로드, 삭제 주소 개선
6. 대용량 첨부파일 다운로드 관련 개선
7. kboard_board_attached 테이블 file_path 데이터형 varchar(255)로 변경
8. 버그 수정
8. 게시글의 답글 개수를 반환하는 코드 개선
9. 버그 수정


5.8
Expand Down

0 comments on commit 7ffe8a0

Please sign in to comment.