답변 2개
채택된 답변
+20 포인트
그누커머스에서는 조금 이름만 바뀌었습니다.
해당 소스에서 바뀐 부분
add_filter('gc_list_search_sql', 'add_list_sql_query_modify', PHP_INT_MAX, 7); //리스트 보기 필터 검색했을때
add_filter('gc_list_nosearch_sql', 'add_list_sql_query_modify', PHP_INT_MAX, 7); //리스트 보기 필터
add_filter('gc_view_content', 'gc_view_content_filter_fn', PHP_INT_MAX, 4);
$gnupress 이 $gcboard 로 바뀜
g5_alert 이 gc_alert 로 바뀜
아래는 그누커머스에 맞게금 고친 소스입니다.
Copy
add_filter('gc_list_search_sql', 'add_list_sql_query_modify', PHP_INT_MAX, 7); //리스트 보기 필터 검색했을때add_filter('gc_list_nosearch_sql', 'add_list_sql_query_modify', PHP_INT_MAX, 7); //리스트 보기 필터 function add_list_sql_query_modify($sql, $board, $sql_search, $sql_order, $search_tag, $from_record, $page_rows){ if( current_user_can( 'administrator' ) ){ //관리자의 경우는 예외 return $sql; } //echo $board['bo_table']; //if( $board['bo_table'] = 'test' ){ //해당 게시판을 지정하려면 조건에 맞게금 쓴다. if( !is_user_logged_in() ){ //비회원인 경우에는 $add_where = " and 0 "; return str_replace($sql_order, $add_where.$sql_order, $sql); } //오직 회원만 내글을 볼수 있게함 $add_where = " and user_id = '".get_current_user_id()."' "; $sql = str_replace($sql_order, $add_where.$sql_order, $sql); //} //end if return $sql;} add_filter('gc_view_content', 'gc_view_content_filter_fn', PHP_INT_MAX, 4); function gc_view_content_filter_fn($conv_content, $wr_content, $board=array(), $view=array()){ global $gcboard; if( current_user_can( 'administrator' ) ){ //관리자의 경우는 예외 return $conv_content; } //echo $board['bo_table']; //if( $board['bo_table'] = 'test' ){ //해당 게시판을 지정하려면 조건에 맞게금 쓴다. if( !empty($view) && !$view['user_id'] || $view['user_id'] != get_current_user_id() ){ //회원 자신의 글이 아니면 $conv_content = ''; gc_alert("글을 볼수 있는 권한이 없습니다."); exit; } //} //end if return $conv_content;}
답변을 작성하려면 로그인이 필요합니다.