안녕하세요. Kboard 포럼원 스킨을 아주 잘 사용 중에 몇 가지 문의할게 있습니다.
1. 로그인 된 회원만 댓글을 달 수 있게 권한 설정하였는데 이 경우 로그인 이후 댓글을 작성하라는 문구 대신에 댓글 입력창을 똑같이 보이되 Submit 버튼을 누르면 비로그인 유저들 경우 로그인을 하라는 문구를 띄우고 싶은데 어디서 가능할까요? document.php 에서 해당 부분은 없어서 여쭤봅니다.
2. 댓글 출력창을 워드프레스 기본 테마와 비슷하게 꾸미고 싶은데 조언 부탁드립니다.
안녕하세요~^^
KBoard 플러그인에서 댓글쓰기 권한이 없는 사용자에게도
댓글 입력 폼을 표시되게 하시려면
FTP로 접속해서 /wp-content/plugins/kboard-comments/skin/사용중인스킨/list-template.php 파일에
아래의 코드를 찾아서
<?php if($commentBuilder->isWriter()):?>
<!-- 댓글 입력 폼 시작 -->
<form id="kboard-comments-form-<?php echo $content_uid?>" method="post" action="<?php echo $commentURL->getInsertURL()?>" enctype="multipart/form-data" onsubmit="return kboard_comments_execute(this);">
<input type="hidden" name="content_uid" value="<?php echo $content_uid?>">
<input type="hidden" name="member_uid" value="<?php echo $member_uid?>">
<div class="kboard-comments-form">
<?php wp_nonce_field('kboard-comments-execute', 'kboard-comments-execute-nonce-'.$content_uid, !wp_doing_ajax())?>
<input type="hidden" name="media_group" value="<?php echo kboard_media_group()?>">
<div class="comments-field field-content">
<?php if(defined('KBOARD_COMMENTS_WP_EDITOR') && KBOARD_COMMENTS_WP_EDITOR):?>
<?php wp_editor($temporary->content, 'comment_content_'.$content_uid, array('media_buttons'=>$board->isAdmin(), 'textarea_name'=>'comment_content', 'tinymce'=>array('init_instance_callback' => 'function(editor){editor.on(\'focus\', kboard_comments_field_show)}')))?>
<?php else:?>
<textarea class="comment-textarea" name="comment_content" placeholder="<?php echo __('Add a comment', 'kboard-comments')?>..." required><?php echo esc_textarea($temporary->content)?></textarea>
<?php endif?>
</div>
<div class="comments-field-wrap">
<?php
// 댓글 입력 필드 시작
ob_start();
?>
<?php if(is_user_logged_in()):?>
<input type="hidden" name="member_display" value="<?php echo $member_display?>">
<?php else:?>
<div class="comments-field field-member-display">
<label class="comments-field-label" for="comment_member_display_<?php echo $content_uid?>"><?php echo __('Author', 'kboard-comments')?></label>
<input type="text" id="comment_member_display_<?php echo $content_uid?>" name="member_display" value="<?php echo $temporary->member_display?>" placeholder="<?php echo __('Author', 'kboard-comments')?>..." required>
</div>
<div class="comments-field field-password">
<label class="comments-field-label" for="comment_password_<?php echo $content_uid?>"><?php echo __('Password', 'kboard-comments')?></label>
<input type="password" id="comment_password_<?php echo $content_uid?>" name="password" value="" placeholder="<?php echo __('Password', 'kboard-comments')?>..." required>
</div>
<?php endif?>
<div class="comments-field field-image1">
<label class="comments-field-label" for="comment_image1_<?php echo $content_uid?>"><?php echo __('Photos', 'kboard-comments')?></label>
<input type="file" id="comment_image1_<?php echo $content_uid?>" name="comment_attach_image1" accept="image/*">
</div>
<div class="comments-field field-file1">
<label class="comments-field-label" for="comment_file1_<?php echo $content_uid?>"><?php echo __('Attachment', 'kboard-comments')?></label>
<input type="file" id="comment_file1_<?php echo $content_uid?>" name="comment_attach_file1">
</div>
<?php if($board->useCAPTCHA()):?>
<?php if(kboard_use_recaptcha()):?>
<div class="comments-field field-recaptcha">
<div class="g-recaptcha" data-sitekey="<?php echo kboard_recaptcha_site_key()?>"></div>
</div>
<?php else:?>
<div class="comments-field field-captcha">
<label class="comments-field-label" for="comment_captcha"><img src="<?php echo kboard_captcha()?>" alt=""></label>
<input type="text" id="comment_captcha" name="captcha" value="" placeholder="CAPTCHA..." required>
</div>
<?php endif?>
<?php endif?>
<?php
// 댓글 입력 필드 출력
$field_html = ob_get_clean();
do_action('kboard_comments_field', $field_html, $board, $content_uid, $commentBuilder);
?>
</div>
<div class="comments-submit-button"><input type="submit" value="<?php echo __('Submit', 'kboard-comments')?>"></div>
</div>
</form>
<!-- 댓글 입력 폼 끝 -->
<?php elseif(is_user_logged_in()):?>
<div class="kboard-comments-login">
<?php echo __('You do not have permission to add comments.', 'kboard-comments')?>
</div>
<?php else:?>
<div class="kboard-comments-login">
<?php
// 로그인 메시지 출력
do_action('kboard_comments_login_content', $board, $content_uid, $commentBuilder);
?>
</div>
<?php endif?>
아래의 코드로 교체해보세요.
<!-- 댓글 입력 폼 시작 -->
<form id="kboard-comments-form-<?php echo $content_uid?>" method="post" action="<?php echo $commentURL->getInsertURL()?>" enctype="multipart/form-data" onsubmit="return kboard_comments_execute(this);">
<input type="hidden" name="content_uid" value="<?php echo $content_uid?>">
<input type="hidden" name="member_uid" value="<?php echo $member_uid?>">
<div class="kboard-comments-form">
<?php wp_nonce_field('kboard-comments-execute', 'kboard-comments-execute-nonce-'.$content_uid, !wp_doing_ajax())?>
<input type="hidden" name="media_group" value="<?php echo kboard_media_group()?>">
<div class="comments-field field-content">
<?php if(defined('KBOARD_COMMENTS_WP_EDITOR') && KBOARD_COMMENTS_WP_EDITOR):?>
<?php wp_editor($temporary->content, 'comment_content_'.$content_uid, array('media_buttons'=>$board->isAdmin(), 'textarea_name'=>'comment_content', 'tinymce'=>array('init_instance_callback' => 'function(editor){editor.on(\'focus\', kboard_comments_field_show)}')))?>
<?php else:?>
<textarea class="comment-textarea" name="comment_content" placeholder="<?php echo __('Add a comment', 'kboard-comments')?>..." required><?php echo esc_textarea($temporary->content)?></textarea>
<?php endif?>
</div>
<div class="comments-field-wrap">
<?php
// 댓글 입력 필드 시작
ob_start();
?>
<?php if(is_user_logged_in()):?>
<input type="hidden" name="member_display" value="<?php echo $member_display?>">
<?php else:?>
<div class="comments-field field-member-display">
<label class="comments-field-label" for="comment_member_display_<?php echo $content_uid?>"><?php echo __('Author', 'kboard-comments')?></label>
<input type="text" id="comment_member_display_<?php echo $content_uid?>" name="member_display" value="<?php echo $temporary->member_display?>" placeholder="<?php echo __('Author', 'kboard-comments')?>..." required>
</div>
<div class="comments-field field-password">
<label class="comments-field-label" for="comment_password_<?php echo $content_uid?>"><?php echo __('Password', 'kboard-comments')?></label>
<input type="password" id="comment_password_<?php echo $content_uid?>" name="password" value="" placeholder="<?php echo __('Password', 'kboard-comments')?>..." required>
</div>
<?php endif?>
<div class="comments-field field-image1">
<label class="comments-field-label" for="comment_image1_<?php echo $content_uid?>"><?php echo __('Photos', 'kboard-comments')?></label>
<input type="file" id="comment_image1_<?php echo $content_uid?>" name="comment_attach_image1" accept="image/*">
</div>
<div class="comments-field field-file1">
<label class="comments-field-label" for="comment_file1_<?php echo $content_uid?>"><?php echo __('Attachment', 'kboard-comments')?></label>
<input type="file" id="comment_file1_<?php echo $content_uid?>" name="comment_attach_file1">
</div>
<?php if($board->useCAPTCHA()):?>
<?php if(kboard_use_recaptcha()):?>
<div class="comments-field field-recaptcha">
<div class="g-recaptcha" data-sitekey="<?php echo kboard_recaptcha_site_key()?>"></div>
</div>
<?php else:?>
<div class="comments-field field-captcha">
<label class="comments-field-label" for="comment_captcha"><img src="<?php echo kboard_captcha()?>" alt=""></label>
<input type="text" id="comment_captcha" name="captcha" value="" placeholder="CAPTCHA..." required>
</div>
<?php endif?>
<?php endif?>
<?php
// 댓글 입력 필드 출력
$field_html = ob_get_clean();
do_action('kboard_comments_field', $field_html, $board, $content_uid, $commentBuilder);
?>
</div>
<div class="comments-submit-button"><input type="submit" value="<?php echo __('Submit', 'kboard-comments')?>"></div>
</div>
</form>
기존 코드를 수정하면 예상치 못한 문제가 있을 수도 있으니 충분히 테스트를 해보세요.
기존 레이아웃을 변경하는 건 HTML과 CSS 코드에 대해 알면 도움이 됩니다.
고맙습니다.