테스트 사이트 - 개발 중인 베타 버전입니다

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

· 1년 전 · 950 · 12

2113539256_1726894787.9766.gif

 

안녕하세요..

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 잘안되신다고 하신던데... 해내셨네요.. 감동입니다.. 혹시 천재가 아닌가 모르겟네요.. 부럽습니다!! 감사합니다! 즐거운 하루 되셨길 바랍니다!

1년 전

감사합니다 ^^

게시글 목록

번호 제목
23606
23598
23585
23579
23578
23564
23550
23549
23548
23529
23510
23507
23481
23471
23453
23452
23450
23436
23428
23404
23396
23389
23380
23369
23350
23337
23317
23307
23298
23290