KBoard(케이보드) 상태 업데이트가 안되요
상태 업데이트를 했는데
제목을 입력하라 그러고 업데이트가 안되요
<input type="hidden" name="title" value="<?php echo $content->title = 구매합니다?>">
이렇게 됐는데
다른 글들을 보고
<input type="hidden" name="title" value="구매합니다">
이렇게 바꿨는데도 안되요.
제 게시판 주소는 http://beastcompany.dothome.co.kr/buy0123/
여기 입니다. 꼭 좀 부탁드릴게요
KBoard 게시판 5.3.3 버전 이상을 사용하고 있다면
자바스크립트 kboard_content_update() 함수를 사용할 수 있습니다.
kboard_content_update() 함수를 사용해서 게시글 정보를 업데이트 할 수 있습니다.
관련 예제도 올려드립니다.
"상태업데이트" 버튼을 클릭하면 게시글의 "category2" 값을 "답변완료" 로 업데이트합니다.
<?php echo $content->uid?> 이건 게시글의 uid값을 출력하는 코드입니다.
<button type="button" onclick="test_kboard_content_update('<?php echo $content->uid?>', '답변완료')">상태업데이트</button>
<script>
function test_kboard_content_update(content_uid, status){
kboard_content_update(content_uid, {category2:status}, function(res){
if(res.result == 'success'){
alert('완료되었습니다.');
window.location.reload();
}
else{
alert(res.message);
}
});
}
</script>
예제를 참고해서 게시글 정보를 업데이트 해보세요.
고맙습니다.
<div id="kboard-avatar-document" class="kboard-request-form">
<div class="kboard-header"></div>
<div class="kboard-document-wrap" itemscope itemtype="http://schema.org/Article">
<div class="kboard-title" itemprop="name">
<p><?php echo $content->title?></p>
</div>
<div class="kboard-detail" >
<div class="kboard-detail" >
<?php if($content->category1):?>
<div class="detail-attr detail-category1">
<div class="detail-name"><?php echo $content->category1?></div>
</div>
<?php endif?>
<?php if($content->category2):?>
<div class="detail-attr detail-category2">
<div class="detail-name"><?php echo $content->category2?></div>
</div>
<?php endif?>
<div class="detail-attr detail-writer" style="padding-top:0; padding-bottom:0;">
<div class="detail-name" style="font-weight: normal; font-size:13px; "><?php echo __('Author', 'kboard')?><?php echo " " ?>:</div>
<div class="detail-value" style=" font-weight: normal; font-size:13px; "><?php echo $content->member_display?></div>
</div>
<div class="detail-attr detail-date" style="padding-top:0; padding-bottom:0;">
<div class="detail-name" style="font-weight: normal; font-size:13px; "><?php echo __('Date', 'kboard')?><?php echo " " ?>:</div>
<div class="detail-value" style=" font-weight: normal; font-size:13px; "><?php echo date('Y-m-d', strtotime($content->date))?></div>
</div>
<div class="detail-attr detail-view" style="padding-top:0; padding-bottom:0;">
<div class="detail-name" style="font-weight: normal; font-size:13px; "><?php echo __('Views', 'kboard')?><?php echo " " ?>:</div>
<div class="detail-value" style="font-weight: normal; font-size:13px; "><?php echo $content->view?></div>
</div>
</div>
<div class="kboard-content" itemprop="description">
<div class="content-view">
<?php if($content->thumbnail_file):?><p class="thumbnail-area"><img src="<?php echo get_site_url() . $content->thumbnail_file?>" alt=""></p><?php endif;?>
<?php if( current_user_can('editor') || current_user_can('administrator') ) : ?>
<?php if($board->isEditor($content->member_uid)):?>
<p>
<div id="kboard-avatar-editor" class="kboard-request-form">
<form method="post" action="<?php echo $url->getContentEditorExecute()?>" enctype="multipart/form-data" onsubmit="return kboard_editor_execute(this);">
<?php wp_nonce_field('kboard-editor-execute', 'kboard-editor-execute-nonce');?>
<input type="hidden" name="action" value="kboard_editor_execute">
<input type="hidden" name="mod" value="editor">
<input type="hidden" name="uid" value="<?php echo $content->uid?>">
<input type="hidden" name="board_id" value="<?php echo $content->board_id?>">
<input type="hidden" name="parent_uid" value="<?php echo $content->parent_uid?>">
<input type="hidden" name="member_uid" value="<?php echo $content->member_uid?>">
<input type="hidden" name="member_display" value="<?php echo $content->member_display?>">
<input type="hidden" name="date" value="<?php echo $content->date?>">
<textarea name="kboard_content" id="kboard_content" style="display:none;"><?php echo $content->content?></textarea>
<div class="kboard-attr-row">
<div class="attr-value" style="display:inline;">
<select id="kboard_option_quotestatus" name="kboard_option_quotestatus" value="<?php echo $content->option->quotestatus?>">
<option value="신청완료"<?php if($content->option->quotestatus == '신청완료'):?> selected<?php endif?>>신청완료</option>
<option value="진행중"<?php if($content->option->quotestatus == '진행중'):?> selected<?php endif?>>진행중</option>
<option value="진행완료"<?php if($content->option->quotestatus == '진행완료'):?> selected<?php endif?>>진행완료</option>
</select>
</div><button type="submit" class="kboard-avatar-button-small" onsubmit="_onSubmit(this);">상태 업데이트</button>
</div>
<div class="attr-value" style="display:none;"><input type="checkbox" name="secret" value="true"<?php if($content->secret):?> checked<?php endif?>></div>
</form>
</div>
</p>
<?php endif?>
<?php endif?>
<?php if(!($content->notice)):?>
<?php if($board->isWriter() && !$board->isAdmin()):?>
<table class="kboarddemo">
<thead>
<tr>
<th colspan="2"><span class="kboard_requester_info" style="font-size: 15px; font-weight: bold;">감사합니다!</span></th>
</tr>
</thead>
<tbody>
<tr>
<td>감사합니다. 문의가 성공적으로 제출되었습니다. 확인 후에 연락을 드리겠습니다.</td>
</tr>
<tbody>
</table>
<?php endif?>
<table class="kboarddemo">
<thead>
<tr>
<th colspan="2"><span class="kboard_requester_info" style="font-size: 15px; font-weight: bold;">신청자 정보</span></th>
</tr>
</thead>
<tbody>
<tr>
<td style="width:30%!important;"><?php echo __('성명', 'kboard')?></td>
<td style="width:70%!important;"><?php if($content->member_uid):?>
<span title="<?php echo $content->member_display?>"><?php echo get_avatar($content->member_uid, 32, $default, $content->member_display);?></span><?php echo $content->member_display . ' '?>
<?php else:?>
<?php echo $content->member_display?>
<?php endif?></td>
</tr>
<tr>
<td><?php echo __('계정번호', 'kboard')?></td>
<td><?php echo $content->option->id-adress?></td>
</tr>
<tr>
<td><?php echo __('연락처', 'kboard')?></td>
<td><?php echo $content->option->usermobilephone?></td>
</tr>
<tr>
<td><?php echo __('이메일', 'kboard')?></td>
<td><?php echo $content->option->useremail?></td>
</tr>
<tr>
<td><?php echo __('구매금액', 'kboard')?></td>
<td><?php echo $content->option->useremoney?></td>
</tr>
<tbody>
</table>
<?php endif?>
<table class="kboarddemo">
<thead>
<tr>
<th colspan="2"><span class="kboard_requester_info" style="font-size: 15px; font-weight: bold;"><?php if($content->notice):?>
공지
<?php else: ?>
메모
<?php endif?></span></th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding: 20px 15px 20px 10px!important;"><?php echo $content->content?></td>
</tr>
<?php if(isset($content->attach->file1)):?>
<tr>
<td><?php echo __('Attachment', 'kboard')?></td>
<td><a href="<?php echo $url->getDownloadURLWithAttach($content->uid, 'file1')?>"><?php echo $content->attach->file1[1]?></a></td>
</tr>
<?php endif?>
<?php if(isset($content->attach->file2)):?>
<tr>
<td><?php echo __('Attachment', 'kboard')?></td>
<td><a href="<?php echo $url->getDownloadURLWithAttach($content->uid, 'file2')?>"><?php echo $content->attach->file2[1]?></a></td>
</tr>
<?php endif?>
<tbody>
</table>
</div>
</div>
</div>
<?php if($board->isComment()):?>
<div class="kboard-comments-area"><?php echo $board->buildComment($content->uid)?></div>
<?php endif?>
<div class="kboard-control">
<div class="left">
<a href="<?php echo $url->toString()?>" class="kboard-avatar-button-small"><?php echo __('List', 'kboard')?></a>
<a href="<?php echo $url->getDocumentURLWithUID($content->getPrevUID())?>" class="kboard-avatar-button-small"><?php echo __('Prev', 'kboard')?></a>
<a href="<?php echo $url->getDocumentURLWithUID($content->getNextUID())?>" class="kboard-avatar-button-small"><?php echo __('Next', 'kboard')?></a>
</div>
<?php if($board->isEditor($content->member_uid) || $board->permission_write=='all'):?>
<div class="right">
<?php if( current_user_can('editor') || current_user_can('administrator') ) : ?>
<a href="<?php echo $url->set('uid', $content->uid)->set('mod', 'editor')->toString()?>" class="kboard-avatar-button-small"><?php echo __('Edit', 'kboard')?></a>
<a href="<?php echo $url->set('uid', $content->uid)->set('mod', 'remove')->toString()?>" class="kboard-avatar-button-small" onclick="return confirm('<?php echo __('Are you sure you want to delete?', 'kboard')?>');"><?php echo __('Delete', 'kboard')?></a>
<?php else: ?>
<a href="<?php echo $url->toString()?>" class="kboard-avatar-button-small"><?php echo __('List', 'kboard')?></a>
<?php endif; // $current forum id() ?>
</div>
<?php endif?>
</div>
<div class="kboard-avatar-poweredby">
<a href="http://www.cosmosfarm.com/products/kboard" onclick="window.open(this.href); return false;" title="<?php echo __('KBoard is the best community software available for WordPress', 'kboard')?>">Powered by KBoard</a>
|| <a href="http://www.thewordcracker.com/specificarea/kboard-skin-download/">Modified by WordCracker</a></div>
</div>
안녕하세요~^^
반드시 KBoard 게시판 플러그인 5.3.3 버전 혹은 이상으로 업데이트 해주셔야 합니다.
아래 코드를 기존에 만든 <form>...</form> 태그 대신 추가해서 테스트를 해보시겠어요?
<select id="kboard_option_quotestatus" name="kboard_option_quotestatus">
<option value="신청완료"<?php if($content->option->quotestatus == '신청완료'):?> selected<?php endif?>>신청완료</option>
<option value="진행중"<?php if($content->option->quotestatus == '진행중'):?> selected<?php endif?>>진행중</option>
<option value="진행완료"<?php if($content->option->quotestatus == '진행완료'):?> selected<?php endif?>>진행완료</option>
</select>
<button type="button" onclick="test_kboard_content_update('<?php echo $content->uid?>', jQuery('[name=kboard_option_quotestatus]').val())">상태업데이트</button>
<script>
function test_kboard_content_update(content_uid, status){
kboard_content_update(content_uid, {kboard_option_quotestatus:status}, function(res){
if(res.result == 'success'){
alert('완료되었습니다.');
window.location.reload();
}
else{
alert(res.message);
}
});
}
</script>
단순 사용자 커뮤니티이기 때문에 저희가 코드를 100% 만들어 드리긴 현실적으로 매우 어렵습니다.
테스트 해보고 알려주세요~^^
고맙습니다.
감사합니다!^^
업데이트 이후 상기 코드는 적용 안되는건가요..?
아무리 해도 안되네요;; ㅜㅜ
안녕하세요~^^
최신 버전의 KBoard 플러그인에도 적용이 됩니다.
실제 적용한 코드가 어떻게 되시는지요?
FTP로 접속해서 /wp-content/plugins/kboard/skin/사용중인스킨/document.php 파일에
적당한 위치에 아래의 코드를 추가해보시겠어요?
<form method="post" action="<?php echo $url->getContentEditorExecute()?>" enctype="multipart/form-data" onsubmit="return kboard_editor_execute(this);">
<select id="kboard_option_quotestatus" name="kboard_option_quotestatus">
<option value="신청완료"<?php if($content->option->quotestatus == '신청완료'):?> selected<?php endif?>>신청완료</option>
<option value="진행중"<?php if($content->option->quotestatus == '진행중'):?> selected<?php endif?>>진행중</option>
<option value="진행완료"<?php if($content->option->quotestatus == '진행완료'):?> selected<?php endif?>>진행완료</option>
</select>
<button type="button" onclick="test_kboard_content_update('<?php echo $content->uid?>', jQuery('[name=kboard_option_quotestatus]').val())">상태업데이트</button>
<script>
function test_kboard_content_update(content_uid, status){
kboard_content_update(content_uid, {kboard_option_quotestatus:status}, function(res){
if(res.result == 'success'){
alert('완료되었습니다.');
window.location.reload();
}
else{
alert(res.message);
}
});
}
</script>
</form>
고맙습니다.
good job nice sir! thx