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>
위 소스는 document.php 내용입니다.
여기에 따로 추가하면 되나요?
document.php 파일 내용 제일 하단에 코드를 넣고 테스트를 해보세요~^^
예제는 category2 정보를 업데이트하는 코드입니다.
만약 다른 정보를 업데이트하고 싶다면 적절히 변경해주시면 됩니다.
어떤 정보를 업데이트하고 싶으신지 알려주시면 도움드리겠습니다.
고맙습니다.
<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>
이렇게 처럼 여러가지 옵션이 있고 상태를 업데이트 하고 싶은데요.
가르쳐 주신 건 버튼을 누르면 바로 되는 건데 옵션이 여러가지로 나오는 방법은 없나요????
아래 링크에 답변드렸습니다.
http://www.cosmosfarm.com/threads/document/15600
가급적이면 하나의 질문글에 댓글로 쭉 남겨주시길 부탁드립니다~^^