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
JediStryker
Hangin' Around


Joined: Jun 27, 2004
Posts: 38
Location: San Antonio, TX

PostPosted: Sun Jul 04, 2004 11:54 am Reply with quote

I know that there used to be a way to fix this, but I haven't been able to find the answer anywhere. It's been a while since I last 'nuked' a webpage, and so I can't remember how this was fixed before.

I am using the scrolling forums block downloaded from this site, of course. RavensScripts

If anyone can help, I'd greatly appreciate it.
 
View user's profile Send private message Send e-mail Visit poster's website AIM Address
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 17086

PostPosted: Sun Jul 04, 2004 1:14 pm Reply with quote

Only registered users can see links on this board! Get registered or login!
 
View user's profile Send private message
JediStryker
PostPosted: Sun Jul 04, 2004 1:21 pm Reply with quote

Hmm...I'll have to try that. I was hoping for something more along the lines of making it so that no forums marked as private will be displayed, so that I don't have to add each forum by it's ID, but I will try this.

I would experiement myself, but my coding skills are a joke. If you ever have a Cisco question, I'm yer man, but otherwise, I'm clueless. Confused
 
Raven
PostPosted: Sun Jul 04, 2004 1:26 pm Reply with quote

I have that post somewhere too Smile - I'll have to dig it out. Wait a minute! If you use the collapsing block like I do, or even if you just get the code, it's already in there. In that case you set a variable like
$HideViewReadOnly = 1;
and then trace the logic to see how it's done Wink
 
JediStryker
PostPosted: Sun Jul 04, 2004 1:41 pm Reply with quote

Honestly, I prefer the scrolling forums block to the center collapsing block. I really don't like the center block all that much, as I find that it's a but intrusive. I prefer all my extra stuff to be in blocks on the left or right. Besides, the scrolling is just so kewl. Wink

I'll keep looking into it, and if one of your suggestions or something else I find works, I'll post it here. Smile
 
JediStryker
PostPosted: Sun Jul 04, 2004 2:04 pm Reply with quote

Alright, here's the code from a Forum Scroll block that is supposed to block unauthorized users from seeing posts in private forums:

Quote:
if (eregi("block-Forums.php", $PHP_SELF)) {
Header("Location: index.php");
die();
}

include_once ('blocks/smileys.php');

global $prefix, $dbi, $sitename, $user, $cookie, $group_id;
cookiedecode($user);
$uname = $cookie[1];
$result10 = sql_query("SELECT u.user_id FROM ".$prefix."_users u where username = '$uname'", $dbi);
list($user_id)=sql_fetch_row($result10, $dbi);
$userid = $user_id;
$count = 1;

$content = "<A name= \"scrollingCode\"></A>";
$content .="<MARQUEE behavior= \"scroll\" align= \"center\" direction= \"up\" height=\"220\" scrollamount= \"2\" scrolldelay= \"20\" onmouseover='this.stop()' onmouseout='this.start()'>";
$content .="<center> <STYLE=\"text-decoration: none\"><font color=\"#666666\"><b>Last 20 Forum Messages</b></center>";

$result1 = sql_query("SELECT DISTINCT t.topic_id, t.topic_last_post_id, t.topic_title, f.forum_name, f.forum_id, f.auth_read
FROM ".$prefix."_bbtopics t, ".$prefix."_bbforums f,".$prefix."_bbuser_group a, ".$prefix."_bbauth_access b
where t.forum_id=f.forum_id and
f.forum_id=b.forum_id and
b.group_id=a.group_id and
(( a.user_id='$userid' and (b.auth_view = 1 or b.auth_mod = 1 )) OR f.auth_read = 0)
ORDER BY t.topic_last_post_id DESC LIMIT 20", $dbi);

$content .= "<br>";


while(list($topic_id, $topic_last_post_id, $topic_title, $forum_name, $forum_id, $auth_read) = 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=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=\"modules.php?name=Forums&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=\"forum-userprofile-.html$user_id\"STYLE=\"text-decoration: none\"> $username </a> in <a href=\"modules.php?name=Forums&amp;file=viewforum&amp;f=$forum_id\">$forum_name</a> on $post_time</i></font><br><br>";
$count = $count + 1;
}
$content .= "<br><center>[ <a href=\"forums.html\"STYLE=\"text-decoration: none\">$sitename ]</center>";
?>


And here is the code from this site:

Quote:
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=\"modules.php?name=Forums&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=\"forum-userprofile-.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>";
?>


Okay, I went through and tired to compare the differences, but when I tried to put them all together, I must have messed something up, because it didn't work. Confused Laughing

Does anyone else want to show me what I need to combine to get the results I want? Very Happy [/quote]
 
Raven
PostPosted: Sun Jul 04, 2004 3:45 pm Reply with quote

JediStryker wrote:
Honestly, I prefer the scrolling forums block to the center collapsing block. I really don't like the center block all that much, as I find that it's a but intrusive. I prefer all my extra stuff to be in blocks on the left or right. Besides, the scrolling is just so kewl. Wink

I'll keep looking into it, and if one of your suggestions or something else I find works, I'll post it here. Smile
I wasn't suggesting that you use it Laughing . I was just saying the logic is in there. Just extract it and use it Smile


Last edited by Raven on Sun Jul 04, 2004 4:09 pm; edited 1 time in total 
JediStryker
PostPosted: Sun Jul 04, 2004 4:03 pm Reply with quote

Understood. I'll do what I can. Smile
 
chatserv
Member Emeritus


Joined: May 02, 2003
Posts: 1389
Location: Puerto Rico

PostPosted: Sun Jul 04, 2004 8:36 pm Reply with quote

Code:
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 DISTINCT t.topic_id, t.topic_last_post_id, t.topic_title, f.forum_name, f.forum_id, f.auth_read FROM ".$prefix."_bbtopics t, ".$prefix."_bbforums f,".$prefix."_bbuser_group a, ".$prefix."_bbauth_access b where t.forum_id=f.forum_id and f.forum_id=b.forum_id and b.group_id=a.group_id and (( a.user_id='$userid' and (b.auth_view = 1 or b.auth_mod = 1 )) OR f.auth_read = 0) ORDER BY t.topic_last_post_id DESC LIMIT $amount", $dbi);
$content .= "<br>";
while(list($topic_id, $topic_last_post_id, $topic_title, $forum_name, $forum_id, $auth_read) = 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' and auth_view='0'", $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=\"forums.html?file=profile&mode=viewprofile&u=$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>";
?>


Last edited by chatserv on Sun Jul 04, 2004 9:49 pm; edited 2 times in total 
View user's profile Send private message Visit poster's website
JediStryker
PostPosted: Sun Jul 04, 2004 9:24 pm Reply with quote

Now getting this error:

Quote:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /hsphere/local/home/pmmicha/dark-frontier.com/includes/sql_layer.php on line 286


above the block, and the block is still there, but there's no posts being shown in the block.

Seems like you're on the right path, but it's still not working.

Honestly, I would help here, but I have absolutely no idea what I'm looking for. Confused
 
chatserv
PostPosted: Sun Jul 04, 2004 9:50 pm Reply with quote

I see why, ok, i edited the code, see if it works now.
 
telli
New Member
New Member


Joined: Sep 24, 2003
Posts: 21

PostPosted: Sun Jul 04, 2004 10:07 pm Reply with quote

Wowser why so many queries? try this for the sql:

Code:
$result = $db->sql_query("SELECT t.topic_id, t.topic_last_post_id, t.topic_title, f.forum_name, f.forum_id, u.username, u.user_id, p.poster_id, FROM_UNIXTIME(p.post_time,'%b %d, %Y at %T') as post_time FROM ".$prefix."_bbtopics t, ".$prefix."_bbforums f LEFT JOIN ".$prefix."_bbposts p ON (p.post_id = t.topic_last_post_id) LEFT JOIN ".$prefix."_users u ON (u.user_id = p.poster_id) WHERE t.forum_id=f.forum_id AND f.auth_view=0 ORDER BY t.topic_last_post_id DESC LIMIT 20");

while(list($topic_id, $topic_last_post_id, $topic_title, $forum_name, $forum_id, $username, $user_id, $poster_id, $post_time) = $db->sql_fetchrow($result)) {

FORUM BLOCK
}


Wink

_________________
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
chatserv
PostPosted: Sun Jul 04, 2004 10:11 pm Reply with quote

The queries are the same originally found on the block (see above), i only edited one of them so that it filters what posts to show, at quick glance i'd say the second query gets the id of the person that posted and the third one grabs the username.
 
JediStryker
PostPosted: Mon Jul 05, 2004 9:18 am Reply with quote

Alright, we've sort of gone full-circle here...it's scrolling and looks beautiful again, but it's still showing the private forums. I tested and made sure, and you can see the forums in the block, but not in the board itself. You can also not click to them from the block.

You can see these forums whether you're logged in as Guest, a regular member, or Admin in the block, but only myself or those with permissions to the forums can access them.
 
JediStryker
PostPosted: Mon Jul 05, 2004 9:42 am Reply with quote

Well, I guess it was right under my nose the whole time; here is the code that worked from NC:

Quote:
if (eregi("block-Forums.php", $PHP_SELF)) {
Header("Location: index.php");
die();
}

include_once ('blocks/smileys.php');

global $prefix, $dbi, $sitename, $user, $cookie, $group_id;
cookiedecode($user);
$uname = $cookie[1];
$result10 = sql_query("SELECT u.user_id FROM ".$prefix."_users u where username = '$uname'", $dbi);
list($user_id)=sql_fetch_row($result10, $dbi);
$userid = $user_id;
$count = 1;

$content = "<A name= \"scrollingCode\"></A>";
$content .="<MARQUEE behavior= \"scroll\" align= \"center\" direction= \"up\" height=\"220\" scrollamount= \"2\" scrolldelay= \"20\" onmouseover='this.stop()' onmouseout='this.start()'>";
$content .="<center> <STYLE=\"text-decoration: none\"><font color=\"#666666\"><b>Last 20 Forum Messages</b></center>";

$result1 = sql_query("SELECT DISTINCT t.topic_id, t.topic_last_post_id, t.topic_title, f.forum_name, f.forum_id, f.auth_read
FROM ".$prefix."_bbtopics t, ".$prefix."_bbforums f,".$prefix."_bbuser_group a, ".$prefix."_bbauth_access b
where t.forum_id=f.forum_id and
f.forum_id=b.forum_id and
b.group_id=a.group_id and
(( a.user_id='$userid' and (b.auth_view = 1 or b.auth_mod = 1 )) OR f.auth_read = 0)
ORDER BY t.topic_last_post_id DESC LIMIT 20", $dbi);

$content .= "<br>";


while(list($topic_id, $topic_last_post_id, $topic_title, $forum_name, $forum_id, $auth_read) = 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=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=\"modules.php?name=Forums&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=\"forum-userprofile-.html$user_id\"STYLE=\"text-decoration: none\"> $username </a> in <a href=\"modules.php?name=Forums&amp;file=viewforum&amp;f=$forum_id\">$forum_name</a> on $post_time</i></font><br><br>";
$count = $count + 1;
}
$content .= "<br><center>[ <a href=\"forums.html\"STYLE=\"text-decoration: none\">$sitename ]</center>";
?>


This was in a file I downloaded from their site, so I don't know if you can use it or not; if you can, though, you might want to change the one you're suppyling so that it automatically doesn't show private forum posts to those who aren't authorized to see them. Only catch is that it requires the smileys.php file, but I bet you could change that. Wink

Hope this helps someone in the future.

JS
 
Muffin
Client


Joined: Apr 10, 2004
Posts: 649
Location: UK

PostPosted: Sat Aug 14, 2004 9:19 am Reply with quote

I dont understand where to put this new code or if it will work for me lol

Can someone point me in the right direction on how to use this code on 7.0

I'm using ravens side block for scrolling forums, but admin and mods threads are showing up on there

_________________
Classic Mini rules the bends & bends the rules!
[img] 
View user's profile Send private message
Pmoney
Hangin' Around


Joined: Jan 18, 2006
Posts: 42

PostPosted: Tue May 09, 2006 9:54 pm Reply with quote

I brought this back from the dead.

I just downloaded the scrolling forums block from this website and implemented it on my Raven Nuke 2.02.02 site.

I am having the same problem, everyone can see the private topics.
I tried modifying the code above but can't get it to work correctly.

Shouldn't the download be updated to include the code so this doesn't happen again?
 
View user's profile Send private message
Pmoney
PostPosted: Tue May 16, 2006 8:23 pm Reply with quote

Can anyone look into this a little deeper?
 
montego
Site Admin


Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Wed May 17, 2006 5:49 am Reply with quote

Quote:

Shouldn't the download be updated to include the code so this doesn't happen again?


Well, I am sure if Raven had the time to review all his downloads, assuming they are all his (which is not a valid assumption), then the answer is "yes", at least where the above patch would be made (actually it has even changed since then, but the above still works).

Regarding the private topics, try something like this post here:
Only registered users can see links on this board! Get registered or login!

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
Pmoney
PostPosted: Sat May 20, 2006 8:23 pm Reply with quote

That worked to supress the forums that I don't want the public to see.
This will solve the problem for now. In the future I hope this block can work the way we want..

Thanks for the suggestion/help, now I can use the block on my homepage! Cool

The result code now look like:
Code:
$result1 = sql_query("SELECT topic_id, topic_last_post_id, topic_title FROM ".$prefix."_bbtopics where forum_id NOT IN(10,11) ORDER BY topic_last_post_id DESC LIMIT $amount", $dbi);

Since forum 10 and 11 are the private ones.
 
golyn
New Member
New Member


Joined: Aug 01, 2006
Posts: 1

PostPosted: Tue Aug 01, 2006 5:46 pm Reply with quote

Pmoney!

That's exactly what I needed! Thanks!

-Golyn
 
View user's profile Send private message
mass
New Member
New Member


Joined: Mar 05, 2007
Posts: 15

PostPosted: Thu Mar 08, 2007 7:29 pm Reply with quote

Is there anyway that the block can be set so that a query is made to the database to see which groups a user belongs to then only the posts within those groups are shown? At the moment, the way it's working for me is that everyone can see ALL of the topics but they just can't access them all. I don't want people to be able to see subjects that they can't access
 
View user's profile Send private message
montego
PostPosted: Fri Mar 09, 2007 6:06 am Reply with quote

I am sure that it is possible, but it would take heavy customization. I have only seen blocks which have an "exclusion list" for excluding certain forums, but not one that takes forum group permissions into account.

That would be quite the handy block though. Wish I had the time to develop it. Sad
 
Gremmie
Former Moderator in Good Standing


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

PostPosted: Fri Mar 09, 2007 8:15 am Reply with quote

I made a block to show the latest forum posts and it hides private forums. It looks like you got an answer, but if you would like to see the SQL I came up with for comparison, see this thread:
Only registered users can see links on this board! Get registered or login!

_________________
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
frisp
Hangin' Around


Joined: Apr 02, 2005
Posts: 29
Location: Penicuik, Scotland

PostPosted: Sat Mar 10, 2007 1:23 am Reply with quote

I hane a forums latest port block that will only shiow topics to the correct auths ie Public, Registered and Private stuff. It's coded for the Helius Theme, but you should be able to rip the code out/ recode to your needs.
Post a reply or PM and I'll try to help sort you out.

_________________
Regards

[_]frisp 
View user's profile Send private message Visit poster's website
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 ©