답변 2개
채택된 답변
+20 포인트
10년 전
제 글 다시 잘 읽어보세요 빠진 사항들이 있네요.
제가 테스트 한 원본 올려봅니다.
Copy
// 글자수 제한var char_min = parseInt(); // 최소var char_max = parseInt(); // 최대 function check(){var is_guest = ; if(is_guest) { alert('로그인 후 작성가능합니다.'); location.href="./login.php"; } } 댓글목록
로그인 후 평가할 수 있습니다
답변에 대한 댓글 1개
10년 전
댓글을 작성하려면 로그인이 필요합니다.
10년 전
요점은 댓글창은 무조건 보이고 비회원은 경고창 후 로그인 페이지로 회원은 작성되고 맞죠?
0. 댓글쓰기 권한 2 회원으로 수정
1. 해당 스킨의 view_comment.skin.php 스킨 상단에 아래 스크립트 추가
Copy
function check(){var is_guest = ; if(is_guest) { alert('로그인 후 작성가능합니다.'); location.href="./login.php"; } }
댓글 입력필드 <textarea onclick="javascript:check();" ............ > onclick 추가.
2. 댓글 쓰는 폼을 감싸고 있는 함수 삭제 (그래야 댓글창 무조건 출력)
Copy
....
3. 아래 비회원작성 필드 삭제
Copy
이름 필수
이렇게 하면 깔끔하게 무조건 댓글창만 보이게 되며 비회원이 클릭시 로그인 페이지로 이동시키며
회원은 그냥 작성 됩니다.
로그인 후 평가할 수 있습니다
답변에 대한 댓글 1개
10년 전
다음과 같이 해 보았으나 기능이 적용이 이루어지지 않고 있습니다.
게시판 관리자에서는 댓글 권한을 2로 설정해노았습니다.
<?php if ($is_guest) {
if($w == '')
$w = 'c';
?>
<!-- 댓글 쓰기 시작 { -->
<aside id="bo_vc_w">
<h2>댓글쓰기</h2>
<form name="fviewcomment" action="./write_comment_update.php" onsubmit="return fviewcomment_submit(this);" method="post" autocomplete="off">
<input type="hidden" name="w" value="<?php echo $w ?>" id="w">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="wr_id" value="<?php echo $wr_id ?>">
<input type="hidden" name="comment_id" value="<?php echo $c_id ?>" id="comment_id">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<input type="hidden" name="is_good" value="">
<div class="tbl_frm01 tbl_wrap">
<table class="comment_maque11">
<tbody>
<?php
if($board['bo_use_sns'] && ($config['cf_facebook_appid'] || $config['cf_twitter_key'])) {
?>
<tr>
<th scope="row">SNS 동시등록</th>
<td id="bo_vc_send_sns"></td>
</tr>
<?php
}
?>
<tr>
<th scope="row">댓글내용</th>
<td>
<?php if ($comment_min || $comment_max) { ?><strong id="char_cnt"><span id="char_count"></span>글자</strong><?php } ?>
<textarea id="wr_content" name="wr_content" maxlength="10000" required class="required" title="내용"
<?php if ($comment_min || $comment_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?php } ?>><?php echo $c_wr_content; ?></textarea>
<?php if ($comment_min || $comment_max) { ?><script> check_byte('wr_content', 'char_count'); </script><?php } ?>
<script>
$("textarea#wr_content[maxlength]").live("keyup change", function() {
var str = $(this).val()
var mx = parseInt($(this).attr("maxlength"))
if (str.length > mx) {
$(this).val(str.substr(0, mx));
return false;
}
});
</script>
</td>
</tr>
</tbody>
</table>
</div>
<div class="btn_confirm">
<input type="submit" id="btn_submit" class="btn_submit_ideaing" value="댓글등록">
</div>
</form>
</aside>
<script>
var save_before = '';
var save_html = document.getElementById('bo_vc_w').innerHTML;
function check(){
var is_guest = <?=$is_guest?>;
if(is_guest) {
alert('로그인 후 작성가능합니다.');
location.href="./login.php";
}
}
내용이 길어서 아래 내용은 생략
</script>
<?php } ?>
<!-- } 댓글 쓰기 끝 -->
게시판 관리자에서는 댓글 권한을 2로 설정해노았습니다.
<?php if ($is_guest) {
if($w == '')
$w = 'c';
?>
<!-- 댓글 쓰기 시작 { -->
<aside id="bo_vc_w">
<h2>댓글쓰기</h2>
<form name="fviewcomment" action="./write_comment_update.php" onsubmit="return fviewcomment_submit(this);" method="post" autocomplete="off">
<input type="hidden" name="w" value="<?php echo $w ?>" id="w">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="wr_id" value="<?php echo $wr_id ?>">
<input type="hidden" name="comment_id" value="<?php echo $c_id ?>" id="comment_id">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<input type="hidden" name="is_good" value="">
<div class="tbl_frm01 tbl_wrap">
<table class="comment_maque11">
<tbody>
<?php
if($board['bo_use_sns'] && ($config['cf_facebook_appid'] || $config['cf_twitter_key'])) {
?>
<tr>
<th scope="row">SNS 동시등록</th>
<td id="bo_vc_send_sns"></td>
</tr>
<?php
}
?>
<tr>
<th scope="row">댓글내용</th>
<td>
<?php if ($comment_min || $comment_max) { ?><strong id="char_cnt"><span id="char_count"></span>글자</strong><?php } ?>
<textarea id="wr_content" name="wr_content" maxlength="10000" required class="required" title="내용"
<?php if ($comment_min || $comment_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?php } ?>><?php echo $c_wr_content; ?></textarea>
<?php if ($comment_min || $comment_max) { ?><script> check_byte('wr_content', 'char_count'); </script><?php } ?>
<script>
$("textarea#wr_content[maxlength]").live("keyup change", function() {
var str = $(this).val()
var mx = parseInt($(this).attr("maxlength"))
if (str.length > mx) {
$(this).val(str.substr(0, mx));
return false;
}
});
</script>
</td>
</tr>
</tbody>
</table>
</div>
<div class="btn_confirm">
<input type="submit" id="btn_submit" class="btn_submit_ideaing" value="댓글등록">
</div>
</form>
</aside>
<script>
var save_before = '';
var save_html = document.getElementById('bo_vc_w').innerHTML;
function check(){
var is_guest = <?=$is_guest?>;
if(is_guest) {
alert('로그인 후 작성가능합니다.');
location.href="./login.php";
}
}
내용이 길어서 아래 내용은 생략
</script>
<?php } ?>
<!-- } 댓글 쓰기 끝 -->
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
해결되였습니다.