채택완료

코멘트 삭제하면...

2014-02-18 (화) 18:57:25 7,753
삭제할 내용을 "삭제된 댓글입니다"
 
라고 업데이트를 하고싶은데
 
혹시 사용하시는 소스가 있으면 부탁드리겠습니다 ㅠㅠ
|

답변 1개 / 댓글 10개

채택된 답변
+20 포인트
bbs/delete_comment.skin
 
// 코멘트 삭제
if (!delete_point($write[mb_id], $bo_table, $comment_id, '코멘트'))
    insert_point($write[mb_id], $board[bo_comment_point] * (-1), "$board[bo_subject] {$write[wr_parent]}-{$comment_id} 코멘트삭제");
// 코멘트 삭제
sql_query(" delete from $write_table where wr_id = '$comment_id' ");
// 코멘트가 삭제되므로 해당 게시물에 대한 최근 시간을 다시 얻는다.
$sql = " select max(wr_datetime) as wr_last from $write_table where wr_parent = '$write[wr_parent]' ";
$row = sql_fetch($sql);
                                     
// 원글의 코멘트 숫자를 감소
sql_query(" update $write_table set wr_comment = wr_comment - 1, wr_last = '$row[wr_last]' where wr_id = '$write[wr_parent]' ");
// 코멘트 숫자 감소
sql_query(" update $g4[board_table] set bo_count_comment = bo_count_comment - 1 where bo_table = '$bo_table' ");
// 새글 삭제
sql_query(" delete from $g4[board_new_table] where bo_table = '$bo_table' and wr_id = '$comment_id' ");
 
 
해당내용 다 주석처리......
 
$subtext="삭제된 댓글입니다.";
//새댓글
sql_query(" update $g4[board_table] set wr_subject = '$subtext', mb_id = '', wr_name = '' where wr_id = '$comment_id' ");
// 새글
sql_query(" update $g4[board_new_table] set wr_subject = '$subtext', mb_id = '', wr_name = '' where bo_table = '$bo_table' and wr_id = '$comment_id' ");

답변에 대한 댓글 10개

update g4_board set wr_subject = '삭제된 댓글입니다.', mb_id = '', wr_name = '' where wr_id = '168698'

1054 : Unknown column 'wr_id' in 'where clause'

error file : /bbs/delete_comment.php

이렇게 뜨네요 ㅠㅠ
죄송합니다 ;;;;;;

$subtext="삭제된 댓글입니다.";

//새댓글

sql_query(" update $write_table set wr_subject = '$subtext', mb_id = '', wr_name = '' where wr_id = '$comment_id' ");

// 새글
sql_query(" update $g4[board_new_table] set wr_subject = '$subtext', mb_id = '', wr_name = '' where bo_table = '$bo_table' and wr_id = '$comment_id' ");

이렇게 해보세요;;;;;;
새글은 걍 삭제로 하기로해서

댓글만 적용하려하는데

다시 기재해주신걸 적용하니...

내용은 유지되고 작성자 아이디 닉네임만 공백으로 업데이트 됩니다 ㅠㅠ

후 세세히 알려주셨는데...ㅠㅠ
맞습니다......글은 유지시키고 제목은 삭제되었습니다로 변경
글슨이의 아이디와 이름은 공백처리시키는 겁니다.....
이렇게 한뒤에 list.skin.php 에 <?=$list[$i][href]?>부분에

if ($list[$i][mb_id] == "" && $is_admin) {
echo $list[$i][href];
}

이렇게하면 관리자만 들어가게하면 됩니다.
젤 중요한 코멘트 내용을 '삭제된 댓글입니다' 라고 변경이 안되고 있어요 ㅠㅠ
아 코멘트죠 ;;;;;;;; 죄송해요 ;;;;;;;;;요즘 정신이 어디로 가는지 ;;
$subtext="삭제된 댓글입니다.";

//새댓글

sql_query(" update $write_table set wr_content = '$subtext', mb_id = '', wr_name = '' where wr_id = '$comment_id' ");

// 새글
sql_query(" update $g4[board_new_table] set wr_content = '$subtext', wr_subject = '$subtext', mb_id = '', wr_name = '' where bo_table = '$bo_table' and wr_id = '$comment_id' ");

이렇게 해보세요;;;;;;
와 정말 감사합니다 ^^

좀더 디테일한건 초짜 혼자 연구해봐야겠네요

삭제이후 내용변경되고

다시 삭제하면 코멘트숫자는 감소가 계속 이루어지네요 ㅠㅠ
제가 알려드린 쿼리문은 단순하게 기존 댓글에 내용을 삭제되었습니다 문구로 변경하고
글쓴이의 아이디와 이름만 제거한거에요........
네 정말 감사합니다 ^^

답변을 작성하려면 로그인이 필요합니다.