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

안녕하세요..
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년 전 | 4402 | ||
| 2394 | 1년 전 | 5049 | ||
| 2393 |
|
1년 전 | 1699 | |
| 2392 |
|
1년 전 | 1358 | |
| 2391 |
|
1년 전 | 1140 | |
| 2390 |
|
1년 전 | 1192 | |
| 2389 | 1년 전 | 1780 | ||
| 2388 | 1년 전 | 1325 | ||
| 2387 | 1년 전 | 1309 | ||
| 2386 |
투명한열정
|
1년 전 | 3073 | |
| 2385 |
|
1년 전 | 2341 | |
| 2384 | 1년 전 | 1668 | ||
| 2383 | 1년 전 | 1803 | ||
| 2382 | 1년 전 | 1455 | ||
| 2381 |
|
1년 전 | 1872 | |
| 2380 | 1년 전 | 1042 | ||
| 2379 | 1년 전 | 1385 | ||
| 2378 | 1년 전 | 919 | ||
| 2377 | 1년 전 | 2997 | ||
| 2376 | 1년 전 | 1562 | ||
| 2375 | 1년 전 | 1735 | ||
| 2374 |
네이비스택
|
1년 전 | 1115 | |
| 2373 | 1년 전 | 1547 | ||
| 2372 | 1년 전 | 1468 | ||
| 2371 |
goodman148
|
1년 전 | 2111 | |
| 2370 | 1년 전 | 1519 | ||
| 2369 |
|
1년 전 | 1032 | |
| 2368 | 1년 전 | 1836 | ||
| 2367 | 1년 전 | 1356 | ||
| 2366 |
|
1년 전 | 1213 | |
| 2365 | 1년 전 | 2142 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기