vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Latest Posts Script showing moderated posts (https://vborg.vbsupport.ru/showthread.php?t=306137)

chrisbr 12-21-2013 05:35 PM

Latest Posts Script showing moderated posts
 
Hi There

I have a version of a latest post script which displays the latest posts onto a non VB page, however, I've noticed that it is displaying posts which are automatically moderated by the forum software.

Is there any way I can stop moderated posts from being shown on my latest posts script?

PHP Code:

<?php
include("global.php");
//Config ID here
$exclude = array('15','22');


$exclude_list        "";
foreach(
$exclude as $key => $value)
{
    
$list_forum     $db->query_read("
                        SELECT *
                        FROM " 
TABLE_PREFIX "forum
                        WHERE `parentlist` LIKE '%
$value,%'
                        "
);
    while (
$forum $db->fetch_array($list_forum))
    { 
        
$exclude_list    .= $forum['forumid'] . ",";
    }
}
$exclude_list            .= "0";

function 
cutnchar($str,$n)
{
if(
strlen($str)<$n) return $str;
    
$html    substr($str,0,$n);
    
$html    substr($html,0,strrpos($html,' '));
    return 
$html '...';
}
$lasttopics $db->query_read("
                        SELECT *
                        FROM " 
TABLE_PREFIX "thread
                        WHERE forumid NOT IN (" 
$exclude_list ")
                        ORDER BY threadid DESC
                        LIMIT 5
                        "
);//LIMIT 5 Is number post will be show
                        
while ($topic $db->fetch_array($lasttopics))
                        { 
                        
?>
                        <li><span><?php echo date("d.m.y",$topic['dateline']); ?></span><a href="http://mydomainname.com/boards/showthread.php?<?php echo $topic['threadid']; ?>"><?php echo cutnchar($topic['title'],25); ?></a></li>
                        <?php
                        
}
                        
?>


kh99 12-21-2013 05:50 PM

I think you just need to check the visible field of the thread table, like (add the middle line):

Code:

                        WHERE forumid NOT IN (" . $exclude_list . ")
                          AND visible = 1
                        ORDER BY threadid DESC


chrisbr 12-21-2013 06:00 PM

Super! That's done the trick

Thanks for the help and the prompt reply :)


All times are GMT. The time now is 03:53 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01077 seconds
  • Memory Usage 1,732KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete