MyBB Community Forums

Full Version: Admins posts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, Im am using this code to show the latest 5 threads on a page:

<?php
//Connect to mybb db
    mysql_connect("localhost", "", "") or die("Could not connect to MySQL");
    mysql_select_db("freencom_forum") or die("Could not connect to MySQL");
    
    //query to get latest 5 threads
    $query = mysql_query("
            SELECT t.*, u.username
            FROM thefrumthreads t
            LEFT JOIN thefrumusers u ON (u.uid=t.uid)
            WHERE 1=1 AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
            ORDER BY t.lastpost DESC 
            LIMIT 0, 5"
        );

    $list = '';
    while($fetch = mysql_fetch_array($query))
    {
        $list .= "<strong><a href=\"forums/showthread.php?tid={$fetch['tid']}\">".htmlspecialchars_uni($fetch['subject'])."</a></strong><br />";
    }
    //output
    echo $list;


?>

Is there a way I can make it not show the posts in a certain forum, like the staff forum?
//query to get latest 5 threads
    $query = mysql_query("
            SELECT t.*, u.username
            FROM thefrumthreads t
            LEFT JOIN thefrumusers u ON (u.uid=t.uid)
            WHERE 1=1 AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
            AND t.fid NOT LIKE 'staff_forums_id'
            ORDER BY t.lastpost DESC
            LIMIT 0, 5"
        );


edit staff_forums_id with your staff forums id that you dont want to show.
Thanks for the reply but that isn't working?
It should only show messages from forums the visitor has permissions to view. IOW, only your moderators should see posts from the moderator forum.