Log in

View Full Version : Plugin Conditional


RTMdotORG
07-14-2010, 04:28 PM
Hi, I have a latest post plugin and I want to not show certain forums, what would I add to this plugin to do so?

$siteposts = $db->query_read("
SELECT thread.lastposter, thread.lastpost, thread.views, thread.open, thread.forumid, thread.replycount, thread.threadid, thread.pollid, thread.title, user.username, user.userid, user.usergroupid, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid FROM thread as thread
LEFT JOIN user AS user ON (user.username = thread.lastposter) ORDER BY lastpost DESC LIMIT 0, 25");
while($latest = $db->fetch_array($siteposts))
{

$latest['title'] = str_replace($hidechar, " ", $latest['title']);

if (strlen($latest['title']) > 28)
{
$latest['title'] = substr($latest['title'], 0, 28) . '...';
}
else
{
$latest['title'] = $latest['title'];
}

$latest['title'] = htmlspecialchars($latest['title']);
$trans = array("&" => "&");
$latest['title'] = strtr($latest['title'], $trans);
$latest['replycount'] = number_format($latest['replycount']);
$lastest[musername] = fetch_musername($latest);
$lastest[musername] = $db->escape_string($lastest['musername']);
$date = date("g:i a",$latest['lastpost']);

$latest_posts .= "
<div style='padding: 4px;'>
<div style='font-size: 11px;'>&bull; <a href='showthread.php?t=$latest[threadid]' title='$latest[title]' style='font-size: 10px;'><b>$latest[title]</b></a></div>
<div style='padding-top: 1px; padding-bottom: 1px;'><a href='member.php?u=$latest[userid]' style='font-size: 9px;'>$latest[musername] Posted this thread at $date</a></div>

</div>";
}
$db->free_result($siteposts);

Guest190829
07-14-2010, 05:53 PM
In the query you need to add a WHERE clause with something like


WHERE thread.forumid NOT IN (X,Y,Z)


Replace X, Y, Z with actual forumids.

Keep in mind that your code does not consider forum permissions!

RTMdotORG
07-14-2010, 05:55 PM
Keep in mind that your code does not consider forum permissions!

Thank you for the reply.
How would I add this?
and where would I add this?
Im still a newbie at coding.

Guest190829
07-14-2010, 06:06 PM
Sorry, I don't have access to the code right now... I think your best bet would be to search for such a modification, I doubt that one hasn't been released yet. Maybe you can adapt to it to suit your needs.