댓글 포인트에 대해서...
본문
게시글에 댓글달면 포인트가 생기게 했는데요...
게시글에 댓글을 여려개 달면 포인트가 계속생기는데...
같은 게시글에 댓글 한개만 포인트가 생기게 하려면 어떡해해야하는지 알려주시면 감사하겠습니다...
write_commnet_update.php
// 포인트 부여
if($wr[wr_comment] < 1 ) {
insert_point($member['mb_id'], $board['bo_comment_point'], "{$board['bo_subject']} {$wr_id}-{$comment_id} 댓글쓰기", $bo_table, $comment_id, '댓글');
}
이런방법이 있어서 적용했는데 적용이 안되더라구요...
답변 4
이렇게 해보세요. 직접 해봤는데 되는 것 같네요
$cmt_write = sql_fetch(" select count(*) as cnt from $write_table where wr_parent = '$wr_id' and wr_is_comment = 1 and mb_id = '{$member['mb_id']}' ");
if ($cmt_write['cnt'] < 2) {
// 포인트 부여
insert_point($member['mb_id'], $board['bo_comment_point'], "{$board['bo_subject']} {$wr_id}-{$comment_id} 댓글쓰기", $bo_table, $comment_id, '댓글');
}
해당 게시물이 본인이 단 게시물이 있는지 확인하는걸 하시고
그 다음에 없으면 포인트 부여 하고 있으면 넘어가면 될듯 합니다.
https://sir.kr/qa/119707?stx=%EB%8C%93%EA%B8%80+1%EA%B0%9C&sst=wr_num&unanswered=0&s_tag=
참고 해보세요~
inset_point 하기전에
해당 글 + 작성자 ID 로 작성한 댓글이 있었는지 확인해서
있으면 통과
없으면 inset_point
빨간색으로 기재된 내용을 따로 추가하셔야 합니다
write_commnet_update.php
// 포인트 부여
$sql = "SELECT COUNT(wr_id) AS cnt FROM 코멘트 테이블 WHERE 글번호컬럼명 = 글번호 AND 작성자컬럼명 = '작성자ID'";
$row = sql_fetch($sql);
if (isset($row['cnt']) === false) {
if($wr[wr_comment] < 1 ) {
insert_point($member['mb_id'], $board['bo_comment_point'], "{$board['bo_subject']} {$wr_id}-{$comment_id} 댓글쓰기", $bo_table, $comment_id, '댓글');
}
}
빨간색부분이 추가된 내용이구요
그누보드 테이블명과 컬럼명은 해당 테이블 찾아보시면 될겁니다.