닉네임 인기검색어 제외 시키려면...

닉네임 인기검색어 제외 시키려면...

QA

닉네임 인기검색어 제외 시키려면...

답변 2

본문

그누보드4에서 아이디 혹은 닉네임 검색어를  인기검색어 SQL에 제외 하려면 ... 어느 파일 인가요?

오직 제목 하고 내용만 검색어만 인기검색어만 등록 하려고 합니다 ...

 

 

이 질문에 댓글 쓰기 :

답변 2

그누보드4에서 검색어 중 '아이디'나 '닉네임' 검색어를 인기검색어에서 제외하고,

'제목'과 '내용' 검색어만 등록되도록 수정하기 위해 ~

 

*/bbs/search.php에 검색어 등록 로직이 존재하며, 이를 수정해 조건을 추가 -

  모든 검색어를 g4[popular_table]에 등록하도록 되어 있는 부분를

  조건부로 변경하여 wr_subject와 wr_content 검색어만 등록되도록 수정.

// 인기검색어
$sql = " insert into $g4[popular_table] set pp_word = '$search_str', pp_date = '$g4[time_ymd]', pp_ip = '$_SERVER[REMOTE_ADDR]' ";
sql_query($sql, FALSE);

  - 위의 인기검색어 등록 부분을 다음과 같이 변경

// 인기검색어 등록 조건
if (in_array($field[$k], ['wr_subject', 'wr_content'])) { // 제목과 내용 검색어만 등록
    $sql = "insert into $g4[popular_table] set 
                pp_word = '$search_str', 
                pp_date = '$g4[time_ymd]', 
                pp_ip = '$_SERVER[REMOTE_ADDR]'";
    sql_query($sql, FALSE);
}

// lib/popular.lib.php 파일에서
// 기존 쿼리를 찾아서
$sql = " select pp_word, count(*) as cnt from $g4[popular_table]
          where pp_date between '$fr_date' and '$to_date'
          group by pp_word
          order by cnt desc
          limit $rows ";
// 다음과 같이 수정
$sql = " select pp_word, count(*) as cnt from $g4[popular_table]
          where pp_date between '$fr_date' and '$to_date'
          and pp_word not in (
              select mb_id from $g4[member_table]
              union
              select mb_nick from $g4[member_table]
          )
          and pp_where in ('wr_subject', 'wr_content')
          group by pp_word
          order by cnt desc
          limit $rows ";
답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 10,649
© SIRSOFT
현재 페이지 제일 처음으로