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

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

· 1년 전 · 949 · 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개

1년 전

감사합니다 

감사합니다

게시글 목록

번호 제목
24318
24317
24315
24309
24294
24293
24277
24262
24260
24253
24251
24236
24233
24228
24226
24221
24214
24203
24201
24199
24196
24195
24194
24192
24191
24187
24185
24183
24172
24168