특정 게시판 / 특정 회원은 공지 작성 허용하기

안녕하세요..
https://sir.kr/qa/543668
내용을 보면서 특정 게시판 내 특정 회원은 공지 작성을 허용하게 수정 하였습니다.
게시판 스킨 write.skin.php 파일을 열면 아래 코드가 있습니다.
(기본 순정 기준 30번 라인)
[code]
if ($is_notice) {
$option .= PHP_EOL.'<li class="chk_box"><input type="checkbox" id="notice" name="notice" class="selec_chk" value="1" '.$notice_checked.'>'.PHP_EOL.'<label for="notice"><span></span>공지</label></li>';
}
[/code]
위 코드를 아래 처럼 변경 해주세요
[code]
$allowed_boards = array('free', 'gallery', 'test'); // 허용할 게시판
$allowed_users = array('test', 'test1', 'test2'); // 허용할 아이디
if ($is_notice || (in_array($bo_table, $allowed_boards) && in_array($member['mb_id'], $allowed_users))) {
$option .= PHP_EOL.'<li class="chk_box"><input type="checkbox" id="notice" name="notice" class="selec_chk" value="1" '.$notice_checked.'>'.PHP_EOL.'<label for="notice"><span></span>공지</label></li>';
}
[/code]
그리고 bbs 폴더 내 write_update.php 파일 141번 라인
[code]
// 외부에서 글을 등록할 수 있는 버그가 존재하므로 공지는 관리자만 등록이 가능해야 함
if (!$is_admin && $notice) {
alert('관리자만 공지할 수 있습니다.');
}
[/code]
를 다음과 같이 변경 합니다.
[code]
// 외부에서 글을 등록할 수 있는 버그가 존재하므로 공지는 관리자만 등록이 가능해야 함
$allowed_boards = array('free', 'gallery', 'test');
$allowed_users = array('test12', 'b', 'te22');
if (!$is_admin && $notice) {
if (!in_array($bo_table, $allowed_boards) || !in_array($member['mb_id'], $allowed_users)) {
alert('관리자 또는 특정 게시판의 허용된 사용자만 공지할 수 있습니다.');
}
}
[/code]
그럼 허용된 게시판 내 허용된 아이디의 경우 공지 작성이 가능합니다.
[수정]
나리야 빌더의 경우 스킨 폴더 / write.skin.php 파일 여시면
[code]
if ($is_notice) {
$option .= $option_start;
$option .= '<input type="checkbox" name="notice" value="1" id="notice" class="custom-control-input" '.$notice_checked.'>';
$option .= '<label class="custom-control-label" for="notice"><span>공지</span></label>';
$option .= $option_end;
}
[/code]
이렇게 생긴 코드가 있습니다. 이 코드를 아래 처럼 변경 해주세요
[code]
$allowed_boards = array('free', 'gallery', 'test'); // 허용할 게시판
$allowed_users = array('test', 'test1', 'test2'); // 허용할 아이디
if ($is_notice || in_array($bo_table, $allowed_boards) && in_array($member['mb_id'], $allowed_users)) {
$option .= $option_start;
$option .= '<input type="checkbox" name="notice" value="1" id="notice" class="custom-control-input" '.$notice_checked.'>';
$option .= '<label class="custom-control-label" for="notice"><span>공지</span></label>';
$option .= $option_end;
}
[/code]
그리고 상단에 추가된 bbs/write_update.php 파일을 변경 해주시면 정상적으로 등록됩니다.

고맙습니다.
댓글 12개
정말 감사드립니다! 잘사용하겠습니다! 감사합니다 진심입니다!
if (IS_NA_BBS && $is_notice) { $as_type_checked = (isset($write['as_type']) && $write['as_type'] == "1") ? ' checked' : ''; $option .= $option_start; $option .= ''; $option .= ''; $option .= $option_end; }
@김은우 나리야 빌더 이신 것 같습니다. 일부 코드가 다르지만 해당 부분을 조건문과 배열만 추가 해보세요
@미니님a 네 방금해봤는데 잘안되네요 나리야빌더는 힘든것같네욯ㅎ
@김은우
확인해보니, 나리야에서도 잘되네요
나리야 스킨 폴더 / write.skin.php 파일 여시면
[code]
if ($is_notice) {
$option .= $option_start;
$option .= '<input type="checkbox" name="notice" value="1" id="notice" class="custom-control-input" '.$notice_checked.'>';
$option .= '<label class="custom-control-label" for="notice"><span>공지</span></label>';
$option .= $option_end;
}
[/code]
이렇게 생긴 코드가 있습니다. 이 코드를 아래 처럼 변경 해주세요
[code]
$allowed_boards = array('free', 'gallery', 'test'); // 허용할 게시판
$allowed_users = array('test', 'test1', 'test2'); // 허용할 아이디
if ($is_notice || in_array($bo_table, $allowed_boards) && in_array($member['mb_id'], $allowed_users)) {
$option .= $option_start;
$option .= '<input type="checkbox" name="notice" value="1" id="notice" class="custom-control-input" '.$notice_checked.'>';
$option .= '<label class="custom-control-label" for="notice"><span>공지</span></label>';
$option .= $option_end;
}
[/code]
그리고 본문에 추가된 bbs/write_update.php 파일을 변경 해주시면 정상적으로 등록됩니다.
@김은우 본문 내용 수정 되었습니다.
bo_1 에 추가하면 좋을듯 싶네요~ ^^
감사합니다.
@미니님a 잘안되신다고 하신던데... 해내셨네요.. 감동입니다.. 혹시 천재가 아닌가 모르겟네요.. 부럽습니다!! 감사합니다! 즐거운 하루 되셨길 바랍니다!
감사합니다 ^^
감사합니다
감사합니다
게시판 목록
그누보드5 팁자료실
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 공지 | 3년 전 | 4410 | ||
| 2604 | 8개월 전 | 674 | ||
| 2603 | 8개월 전 | 734 | ||
| 2602 | 8개월 전 | 648 | ||
| 2601 |
|
8개월 전 | 671 | |
| 2600 |
|
8개월 전 | 579 | |
| 2599 | 8개월 전 | 809 | ||
| 2598 | 8개월 전 | 602 | ||
| 2597 |
다케미카코
|
8개월 전 | 756 | |
| 2596 | 8개월 전 | 854 | ||
| 2595 |
|
8개월 전 | 446 | |
| 2594 | 9개월 전 | 608 | ||
| 2593 |
만두먹고또먹고
|
9개월 전 | 937 | |
| 2592 | 9개월 전 | 611 | ||
| 2591 | 9개월 전 | 620 | ||
| 2590 | 9개월 전 | 688 | ||
| 2589 |
|
9개월 전 | 758 | |
| 2588 | 9개월 전 | 476 | ||
| 2587 | 9개월 전 | 796 | ||
| 2586 | 9개월 전 | 643 | ||
| 2585 | 9개월 전 | 511 | ||
| 2584 | 9개월 전 | 576 | ||
| 2583 | 9개월 전 | 498 | ||
| 2582 | 9개월 전 | 643 | ||
| 2581 | 9개월 전 | 598 | ||
| 2580 |
만두먹고또먹고
|
9개월 전 | 517 | |
| 2579 |
|
9개월 전 | 664 | |
| 2578 | 9개월 전 | 647 | ||
| 2577 | 9개월 전 | 627 | ||
| 2576 | 9개월 전 | 562 | ||
| 2575 |
이슈DEV
|
10개월 전 | 993 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기