안녕하세요. 카테고리 변경 시, 댓글 문의드립니다.

안녕하세요.

'답변 완료' 카테고리로 변경이 되면, 댓글 작성을 못하게 하고 싶습니다.

댓글 작성 form 만 제거하고 싶어서, function 으로 form id 제거를 해봤는데.. 잘 안되네요.

혹시 다른 방법이 있는지 문의드립니다!

답변 감사합니다!!

워드프레스 에러 기술지원 서비스 전문가에게 맡기세요
워드프레스 에러 기술지원 서비스 전문가에게 맡기세요
  • $board->currentCategory() 함수를 사용하면 될까요? 

  • <div id="kboard-comments-<?php echo $content_uid?>" class="kboard-comments-default">
            <div class="kboard-comments-wrap">
    
                    <div class="comments-header">
                            <div class="comments-count">
                                    <?php echo __('Total Reply', 'kboard-comments')?> <span class="comments-total-count"><?php echo $commentList->getCount()?></span>
                            </div>
    
                    <!-- 댓글 리스트 시작 -->
                    <?php $commentBuilder->buildTreeList('list-template.php')?>
                    <!-- 댓글 리스트 끝 -->
                    <?php if(!$board->currentCategory() == '답변완료'):?>
                    <?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')?>
                                    <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', array('media_buttons'=>$board->isAdmin(), 'tinymce'=>array('init_instance_callback' => 'function(editor){editor.on(\'focus\', kboard_comments_field_show)}')))?>
                                            <?php else:?>
                                                    <textarea name="comment_content" placeholder="<?php echo __('Add a comment', 'kboard-comments')?>..." required><?php echo $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 __('Author', 'kboard-comments')?></label>
                                                    <input type="text" id="comment_member_display" 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 __('Password', 'kboard-comments')?></label>
                                                    <input type="password" id="comment_password" 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">사진</label>
                                                    <input type="file" id="comment_image1" name="comment_attach_image1" accept="image/*">
                                            </div>
    
                                            <div class="comments-field field-file1">
                                                    <label class="comments-field-label" for="comment_file1">첨부파일</label>
                                                    <input type="file" id="comment_file1" 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?>
                    <?php endif?>
            </div>
    </div>
    
    <?php wp_enqueue_script('kboard-comments-default-script', "{$skin_path}/script.js", array(), KBOARD_COMMNETS_VERSION, true)?>

     

    위와 같이 진행하고 있습니다.

    적용이 안됩네요. 혹시 comment 플러그인의 list.php 에서 $content 를 불러오는 방법이 있을까요? 

    $content->category2 를 받아올 수 있으면 손쉽게 가능할 것 같습니다!

     

  • 안녕하세요~^^

    KBoard 댓글 플러그인 list.php 파일에서

    게시글 카테고리2를 불러오시려면

    list.php 파일에

    아래의 코드를 활용해보시겠어요?

    <?php
    $content = new KBContent();
    $content->initWithUID($content_uid);
    ?>

    실제 카테고리2는 $content->category2 코드를 활용해보세요.

    고맙습니다.

  • 감사합니다!!

    바로 해결 됬습니다. 

워드프레스 에러 기술지원 서비스 전문가에게 맡기세요