목록에서 내가 쓴 답글만 볼 수 있게 하는 방법

안녕하세요.

케이보드 감사히 사용하고 있습니다.

이번에 케이보드를 활용하여 홈페이지를 만드는 중에 어려움을 겪고 있어서 문의 남깁니다.

게시판에서 답글을 달면 해당 글에 달린 모든 답글이 보이는데요.

특정 게시판에서 내가 단 답글만 리스트에서 보이고 다른 사람이 단 답글은 리스트에 노출되지 않게 하는 방법이 있을까요?

검토해주시고 방법 있다면 제시 부탁드립니다.

감사합니다.

워드프레스 에러 기술지원 서비스 전문가에게 맡기세요
워드프레스 에러 기술지원 서비스 전문가에게 맡기세요
  • 안녕하세요~^^

    KBoard 플러그인 게시글 목록 페이지에서

    내가 쓴 답글만 표시하게 하시려면

    KBoard 플러그인 코드를 수정해주셔야 할 듯합니다.

     

    FTP로 접속해서 /wp-content/plugins/kboard/class/KBContentList.class.php 파일에

    아래의 코드를 찾아서

    public function getReplyList($parent_uid){
    	global $wpdb;
    	
    	$where[] = "`parent_uid`='$parent_uid'";
    	
    	// 휴지통에 없는 게시글만 불러온다.
    	$where[] = "(`status`='' OR `status` IS NULL OR `status`='pending_approval')";
    	
    	$this->resource_reply = $wpdb->get_results("SELECT * FROM `{$wpdb->prefix}kboard_board_content` WHERE " . implode(' AND ', $where) . " ORDER BY `date` ASC");
    	$wpdb->flush();
    	
    	return $this->resource_reply;
    }

    아래의 코드로 교체해보세요.

    public function getReplyList($parent_uid){
    	global $wpdb;
    	
    	$from[] = "`{$wpdb->prefix}kboard_board_content`";
    	
    	$where[] = "`parent_uid`='$parent_uid'";
    	
    	// 휴지통에 없는 게시글만 불러온다.
    	$where[] = "(`status`='' OR `status` IS NULL OR `status`='pending_approval')";
    	
    	$select = apply_filters('kboard_reply_list_select', '*', $this->board_id, $this);
    	$from = apply_filters('kboard_reply_list_from', implode(' ', $from), $this->board_id, $this);
    	$where = apply_filters('kboard_reply_list_where', implode(' AND ', $where), $this->board_id, $this);
    	$orderby = apply_filters('kboard_reply_list_orderby', "`date` ASC", $this->board_id, $this);
    	
    	$this->resource_reply = $wpdb->get_results("SELECT {$select} FROM {$from} WHERE {$where} ORDER BY {$orderby}");
    	$wpdb->flush();
    	
    	return $this->resource_reply;
    }

     

    /wp-content/plugins/kboard/class/KBoardBuilder.class.php 파일에

    아래의 코드를 찾아서

    public function builderReply($parent_uid, $depth=0){
    	$list = new KBContentList();

    아래의 코드로 교체해보세요.

    public function builderReply($parent_uid, $depth=0){
    	$list = new KBContentList($this->board_id);

     

    마지막으로, 워드프레스 관리자 -> 외모 -> 테마 편집기 페이지에서 functions.php 파일 하단에

    아래의 코드를 추가해보세요.

    add_filter('kboard_reply_list_where', 'my_kboard_reply_list_where', 10, 3);
    function my_kboard_reply_list_where($where, $board_id, $content_list){
    	if($board_id == '1'){ // 실제 게시판 id로 적용해주세요.
    		$user_id = get_current_user_id();
    		if($user_id){
    			$where .= " AND `member_uid`='{$user_id}'";
    		}
    		else{
    			$where = "1=0";
    		}
    	}
    	return $where;
    }

    위의 코드에서 $board_id == '1' 부분은 실제 게시판 id로 적용해보세요.

     

    코드 변경사항은 아래 링크에서도 확인 가능합니다.

    https://github.com/cosmosfarm/KBoard-wordpress-plugin/commit/a902cbd907848639e66869863bd2272196ff6c28

    위 변경사항은 추후 업데이트에 반영하도록 하겠습니다.

    고맙습니다.

좋은 정보와 인맥을 동시에, 워드프레스 사용자 단톡방 참여하기