Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
techforce
New Member
New Member


Joined: Feb 13, 2008
Posts: 6

PostPosted: Wed Feb 13, 2008 4:35 pm Reply with quote

I just installed this on Nuke 7.9 - nice !

Id like to mod it so that the private and hidden (moderator or admin) type forum posts dont get shown.

I guess a config type thing like:

$ignore_pvt = 0 // 0 to include pvt / hidden forums, 1 to ignore

Then modified code in the countdown sequence. Anyone interested to help?
I know some PHP, but am bad with the globals.
 
View user's profile Send private message
Gremmie
Former Moderator in Good Standing


Joined: Apr 06, 2006
Posts: 2415
Location: Iowa, USA

PostPosted: Wed Feb 13, 2008 6:22 pm Reply with quote

Post the block here and perhaps we can tell you how to modify the SQL.

_________________
Only registered users can see links on this board! Get registered or login! - An Event Calendar for PHP-Nuke
Only registered users can see links on this board! Get registered or login! - A Google Maps Nuke Module 
View user's profile Send private message
techforce
PostPosted: Wed Feb 13, 2008 9:23 pm Reply with quote

<?php

/************************************************************************/
/* Forums Block for phpBB 2.0.0 port to PHP Nuke 5.5 */
/* ================================================= */
/* */
/* Copyright (c) 2002 by Francisco Burzi (fbc@mandrakesoft.com) */
/* Only registered users can see links on this board! Get registered or login! */
/* */
/* Version 1, modified by Sébastien Vaast */
/* Only registered users can see links on this board! Get registered or login! */
/* */
/* */
/* Last Edited - 09 May 2002 */
/* */
/* This Block shows the last 10 topics where a message was posted, */
/* along with the username of the last poster and the day and time */
/* of the post. */
/* It will also show smileys in the topic titles thanks to the */
/* smileys.php file found in Leo Tan Block Forums version */
/* (http://www.cybercomp.d2g.com). */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
/************************************************************************/
/* Modified by Gaylen Fraley Only registered users can see links on this board! Get registered or login! */
/************************************************************************/

if (eregi("block-ForumsScroll.php", $_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}

//include_once ('blocks/smileys.php');

global $prefix, $dbi, $sitename, $user, $cookie, $group_id;
$count = 1;
$amount = 15;
$content = "<A name= \"scrollingCode\"></A>";
$content .="<MARQUEE behavior= \"scroll\" align= \"center\" direction= \"up\" height=\"220\" scrollamount= \"2\" scrolldelay= \"25\" onmouseover='this.stop()' onmouseout='this.start()'>";
$content .="<center> <STYLE=\"text-decoration: none\"><font color=\"#666666\"><b>Last $amount Forum Messages</b></center>";
$result1 = sql_query("SELECT topic_id, topic_last_post_id, topic_title FROM ".$prefix."_bbtopics ORDER BY topic_last_post_id DESC LIMIT $amount", $dbi);
$content .= "<br>";
while(list($topic_id, $topic_last_post_id, $topic_title) = sql_fetch_row($result1, $dbi)) {
$result2 = sql_query("SELECT topic_id, poster_id, FROM_UNIXTIME(post_time,'%b %d, %Y at %T') as post_time FROM ".$prefix."_bbposts where post_id='$topic_last_post_id'", $dbi);
list($topic_id, $poster_id, $post_time)=sql_fetch_row($result2, $dbi);

$result3 = sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$poster_id'", $dbi);
list($username, $user_id)=sql_fetch_row($result3, $dbi);

//$topic_title = substr("$topic_title", 0,17);
//$topic_title=parseEmoticons($topic_title);
// Remove the comment below to add the counter
//$content .="<STYLE=\"text-decoration: none\"><font color=\"#666666\"><b>Message: $count<br></b>";

$content .= "<img src=\"modules/Forums/templates/subSilver/images/icon_mini_message.gif\" border=\"0\"alt=\"\"><a href=\"forums.html?amp;file=viewtopic&amp;p=$topic_last_post_id#$topic_last_post_id\"STYLE=\"text-decoration: none\"><b> $topic_title </b></a><br><font color=\"#666666\"><i>Last post by <A HREF=\"profile-.html$user_id\"STYLE=\"text-decoration: none\"> $username </a> on $post_time</i></font><br><br>";
$count = $count + 1;
}
$content .= "<br><center>[ <a href=\"forums.html\"STYLE=\"text-decoration: none\">$sitename ]</center>";
//$content .= "<center><img src=\"images/banners/fatalexception-logo-88x31.gif\" border=\"0\"></center>";
$content .= "</a>";
?>
 
Gremmie
PostPosted: Wed Feb 13, 2008 10:27 pm Reply with quote

Warning, not tested, but try changing this line:

Code:


$result1 = sql_query("SELECT topic_id, topic_last_post_id, topic_title FROM ".$prefix."_bbtopics ORDER BY topic_last_post_id DESC LIMIT $amount", $dbi);


to this:

Code:


$result1 = sql_query("SELECT b.topic_id, b.topic_last_post_id, b.topic_title FROM {$prefix}_bbtopics as b, {$prefix}_bbforums as f, {$prefix}_bbtopics as t WHERE b.topic_id = t.topic_id AND t.forum_id = f.forum_id AND f.auth_view = 0 ORDER BY b.topic_last_post_id DESC LIMIT $amount", $dbi);


If that doesn't work, try another block. There are many out there that exclude private forums.
 
techforce
PostPosted: Wed Feb 13, 2008 10:49 pm Reply with quote

Ok, thanks, not bad. Its no longer posting the private etc posts. It is however avoiding a forum which is in a group of other forums that are private, and is in fact public. Id also like it to post announcements as well as stickys, if they are as recent. I will play around with some others as you have sugguested. This will work for me for now though, thanks again Smile

UPDATE - EDIT: Scratch that comment about it avoiding the forum - that forum is indeed hidden, so the script really works perfectly.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©