В общем делаю предмодерацию комментарием, сделал таблицу - approve, где 1 выводит коммент, а 0 соответственно нет, но проблема не могу все понять как поставить этот фильтр чтобы на сайте не отображались комменты которые на модерации.
Движок DLE, но это отдельный модуль.
// Вывод комментариев
if( $comm_num > 0 )
{
require_once( ENGINE_DIR."/modules/board/tree.comments.class.php" );
$Board->Config['com_sort'] = ( $Board->Config['com_sort'] == "desc" ) ? "desc" : "asc";
$TreeCom = new tree_comments();
$TreeCom->CreateDB( "", $Board->Config['com_sort'] );
$com_on_page = intval( $Board->Config['com_max_on_page'] );
if( $Board->Config['com_navigation_on'] == "yes" && $com_on_page > 0 )
{
$CatAltName = $Board->DB['category'][ $category ]['alt_name'];
$LinkCat = $Board->ReturnLinkCategory( $category );
if( $config['allow_alt_url'] )
$com_url = "{$LinkCat}comm-nom-{page}/{$id}-{$alt_name}.html#otz";
else
$com_url = "/index.php?do=board&boardcat={$CatAltName}&id={$id}&com_page={page}";
$TreeCom->URL = $com_url;
$TreeCom->Navigation = true;
$TreeCom->ComOnPage = $com_on_page;
$TreeCom->Page = intval( $_REQUEST['com_page'] );
if( $Banki->Config['com_ajax_navigation'] == "yes" ) $TreeCom->Ajax = true;
}
else
{
$TreeCom->Navigation = false;
}
if( $Board->Config['com_allocation'] == "yes" ) $TreeCom->AllocationGroups = true;
if( $Board->Config['com_alternation'] == "yes" ) $TreeCom->Alternation = true;
if( $allow_add_com ) $TreeCom->AllowAdd = true;
$allow_group_com_moder = explode( ",", $Board->Config['com_groups_moder'] );
if( in_array( $member_id['user_group'], $allow_group_com_moder ) ) $TreeCom->AllowEdit = true;
$TreeCom->ComDIR = "board/{$Folder}/comments";
$TreeCom->Page = intval( $_REQUEST['com_page'] );
$TreeCom->start();
$TreeCom->BuildNavigation();
$tpl->result['board_comments'] = "<div id=\"BoardCommentsList\">{$tpl->result['board_comments']}</div>{$tpl->result['nav_comments']}";
$TreeCom->apocalypse();
}
Код из: require_once( ENGINE_DIR."/modules/board/tree.comments.class.php" );
//----------------------------------------------------
// Функция запроса базы данных для листа комментариев
//----------------------------------------------------
public function CreateDB( $sort = "", $order = "", $query = "" ){
global $db, $id;
$this->NewsID = $id;
if( !$sort ) $sort = PREFIX."_Board_comments.id";
$sort = "ORDER BY {$sort}";
if( empty( $query ) )
{
$query = "SELECT ".PREFIX."_Board_comments.id, Board_id, del, author_id, answer, author, text, otziv, name_otziv, tit_otziv, ip, date, ".PREFIX."_Board_comments.email as com_email, ".USERPREFIX."_users.email, news_num, comm_num, user_group, reg_date, signature, foto, fullname, land, xfields, name FROM ".PREFIX."_Board_comments LEFT JOIN ".USERPREFIX."_users ON ".PREFIX."_Board_comments.author_id=".USERPREFIX."_users.user_id WHERE ".PREFIX."_Board_comments.Board_id = '{$this->NewsID}' {$sort} {$order}";
}
$result = $db->query( $query );
if( $db->num_rows( $result ) > 0 )
{
while( $row = $db->get_row( $result ) )
{
$this->IdAnswer[ $row['id'] ] = $row['answer'];
if( $row['answer'] ) $this->AnswerId[ $row['answer'] ][] = $row['id'];
$this->Row[ $row['id'] ] = $row;
if( !$row['answer'] ) $this->CountCom++;
}
return true;
}
return false;
}