T
T
timers2018-12-10 12:28:56
DLE
timers, 2018-12-10 12:28:56

Pre-moderation of comments, why displays everything?

In general, I do pre-moderation with a comment, I made a table - approve, where 1 displays a comment, and 0, respectively, does not, but the problem is I can’t figure out how to put this filter so that comments that are under moderation are not displayed on the site.
DLE engine, but this is a separate module.

// Вывод комментариев
    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();
      }

Code from: 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;
  }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Tutubalin, 2018-12-10
@Kennius

In Dle, and so there is a pre-moderation of comments just in the table dle_comments approve means 0 for moderation, 1 output to the site

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question