금지어 추가하는법

현재 kboard에서제공되는것은 제목과 내용 댓글 이 세개만 금지어가 가능한데

다른입력필드에 금지어하는법을알고싶습니다

좋은 정보와 인맥을 동시에, 워드프레스 사용자 단톡방 참여하기
좋은 정보와 인맥을 동시에, 워드프레스 사용자 단톡방 참여하기
  • 안녕하세요~^^

    KBoard 본문/제목/댓글 금지단어 설정을 다른 입력 필드에도 적용하고 싶으신 건지요?

    아래의 코드를 추가해보시겠어요?

    add_action('kboard_pre_content_execute', 'kboard_pre_content_execute_20211224', 10, 2);
    function kboard_pre_content_execute_20211224($content, $board){
    	if($board->id == '1'){ // 실제 게시판 id로 적용해주세요.
    		$text = isset($_POST['kboard_option_메타키']) ? $_POST['kboard_option_메타키'] : '';
    		
    		$replace = array(' ', '「', '」', '『', '』', '-', '_', '.', '(', ')', '[', ']', ',', '~', '*', '+', '^', '♥', '★', '!', '#', '=', '­', '[', ']', '/', '▶', '▷', '<', '>', '%', ':', 'ღ', '$', '*', '♣', '♧', '☞');
    		
    		$content_filter = kboard_content_filter(true);
    		if($content_filter){
    			$subject = urldecode($text);
    			$subject = strtolower($subject);
    			$subject = str_replace($replace, '', $subject);
    			
    			$content_filter_message = get_option('kboard_content_filter_message', '');
    			
    			foreach($content_filter as $filter){
    				if($filter && strpos($subject, $filter) !== false){
    					if($content_filter_message){
    						$content_filter_message = sprintf($content_filter_message, $filter);
    					}
    					else{
    						$content_filter_message = sprintf(__('%s is not available.', 'kboard'), $filter);
    					}
    					$content_filter_message = apply_filters('kboard_content_filter_message', $content_filter_message, $filter, $subject, $board);
    					die("<script>alert('".$content_filter_message."');history.go(-1);</script>");
    				}
    			}
    		}
    	}
    }

    위의 코드에서 $board->id == '1' 부분은 실제 게시판 id로 적용해주세요.

    메타키 부분은 실제 입력 필드의 메타키(옵션키)로 적용해주세요.

     

    테마의 functions.php 파일에 코드를 추가하거나 Code Snippets 플러그인을 사용해서 코드를 추가할 수 있습니다.

    고맙습니다.

  • #커뮤니티 자동 추천글

    KBoard 커뮤니티

    은택의 스레드

    더보기

워드프레스 에러 기술지원 서비스 전문가에게 맡기세요