TinyPortal

Development => Support => Topic started by: gffb on May 28, 2007, 03:47:04 AM

Title: Recent Articles Block showing up-aproved articles
Post by: gffb on May 28, 2007, 03:47:04 AM
I am using the code below toshow recent articles and it work fine except it shows a link to articles that are waiting aproval, if the link it clicked it will not show the article but would rather it did not show article till aproved. any ideas?
global $db_prefix, $scripturl;

$articles = db_query("
        SELECT art.date, art.author, art.subject, art.id, var.value1 AS category_name
        FROM {$db_prefix}tp_articles AS art
                LEFT JOIN {$db_prefix}tp_variables AS var ON (var.id = art.category)
        LIMIT 10", __FILE__,__LINE__);

echo '
<table cellspacing="0" cellpadding="0" width="100%" >';

if (mysql_fetch_assoc($articles) == 0)
        echo '
<tr>
<td>No Articles Submitted</td>
</tr>';
else
{
        while ($row = mysql_fetch_assoc($articles))
                echo '
<tr>
<td><font size="1">
<a href="', $scripturl ,'?page=', $row['id'], '"><b>', $row['subject'], '</b></a>
<div style="padding: 4px; padding-top: 0px;">
By : <b>', $row['author'], '</b><br />
Category: ', $row['category_name'], '
</div>

</td>
</tr>';


}
echo '
</table>';

mysql_free_result($articles);