>>  Site Map >>  Forums >>  Blocks

Forum module - topics in forum:



Blocks - Having problems with a block? Code doesn't work, get help here.



Latest Posts Block Permissions

I'm using a center recent posts block. Here is the code:
Code: :
<?php

########################################################################
# PHP-Nuke Block: Helius Center Forum Block v.9                        #
# Made for PHP-Nuke 6.* and the phpbb2 Nuke port 2.06 only             #
# Modified to incorporate my site theme - Guardian                     #
# Made by coldblooded http://www.nukemods.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.       #
# If you modify this, let me know for fun. =)                          #
########################################################################
## Modified by Gaylen Fraley (aka Raven) 8/13/2005 to allow blocking  ##
## certain categories. Also changed $dbi calls to $db                 ##
########################################################################

if (eregi("block-LIMITED_CAT_CENETER_FORUM.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}
global $user_prefix, $db, $theme, $sitename, $admin, $bgcolor1, $bgcolor2, $bgcolor4;

$HideViewReadOnly = 1;
$Last_New_Topics  = 5;
$ThemeSel = get_theme();
$show = "  <tr>
    <td bgcolor=\"#FABF0D\" height=\"25\" colspan=\"6\" align=\"center\" background=\"themes/$ThemeSel/forums/images/top_center.gif\"></td>
  </tr>
</table></td>
        </tr>
      </table></td>
  </tr>
</table>";

$Count_Topics = 0;
$Topic_Buffer = "";

$catIdsToSkip = '17'; // enter cat ID'd to be removed
// retrieve DB data
$sql = "SELECT t.topic_id, f.forum_id, t.topic_last_post_id, t.topic_title, t.topic_poster, t.topic_views, t.topic_replies, t.topic_moved_id FROM ".$user_prefix."_bbtopics t, ".$user_prefix."_bbforums f where f.cat_id NOT IN($catIdsToSkip) AND t.forum_id=f.forum_id ORDER BY topic_last_post_id DESC";
$result = $db->sql_query($sql);

while( list( $topic_id, $forum_id, $topic_last_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $topic_moved_id ) = $db->sql_fetchrow( $result) )

{
// finished data retreival
   $skip_display = 0;
   if( $HideViewReadOnly == 1 )
   {
      $result2 = $db->sql_query( "SELECT auth_view, auth_read FROM ".$user_prefix."_bbforums where forum_id = '$forum_id'");
      list( $auth_view, $auth_read ) = $db->sql_fetchrow( $result2 );
      if( ( $auth_view != 0 ) or ( $auth_read != 0 ) ) { $skip_display = 1; }
   }

   if( $topic_moved_id != 0 )
   {
     // Shadow Topic !!
      $skip_display = 1;
   }

   if( $skip_display == 0 )
   {
     $Count_Topics += 1;

$result2 = $db->sql_query("SELECT username, user_id FROM ".$user_prefix."_users where user_id='$topic_poster'");
list($username, $user_id)=$db->sql_fetchrow($result2);
$avtor=$username;
$sifra=$user_id;

$result3 = $db->sql_query("SELECT poster_id, FROM_UNIXTIME(post_time,'%m/%d/%Y at %H:%i') as post_time FROM ".$user_prefix."_bbposts where post_id='$topic_last_post_id'");
list($poster_id, $post_time)=$db->sql_fetchrow($result3);

$result4 = $db->sql_query("SELECT username, user_id FROM ".$user_prefix."_users where user_id='$poster_id'");
list($username, $user_id)=$db->sql_fetchrow($result4);

                         $viewlast .="  <tr>
    <td height=\"34\" nowrap bgcolor=\"#EAEDF4\" class=\"row1\"><img src=\"themes/$ThemeSel/forums/images/folder_new.gif\" border=\"0\" /></td>
    <td width=\"100%\" bgcolor=\"#EAEDF4\" class=\"row1\"> ;;<a href=\"forums.html&file=viewtopic&t=$topic_id#$topic_last_post_id\">$topic_title</a></td>
    <td align=\"center\" bgcolor=\"#F8F9FA\" class=\"row2\">$topic_replies</td>
    <td align=\"center\" bgcolor=\"#EAEDF4\" class=\"row3\"><a href=\"profile-.html$sifra\">$avtor</a></td>
    <td align=\"center\" bgcolor=\"#F8F9FA\" class=\"row2\">$topic_views</td>
    <td align=\"center\" nowrap bgcolor=\"#EAEDF4\" class=\"row3\"><font size=\"-2\"><i> ;; ;;$post_time ;;</i></font><br>
      <a href=\"profile-.html$user_id\">$username</a> ;;<a href=\"forums.html&file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\"><img src=\"themes/$ThemeSel/forums/images/icon_minipost_new.gif\" border=\"0\" alt=\"Latest Post\"></a></td>
  </tr>";
}

   if( $Last_New_Topics == $Count_Topics ) { break 1; }

}

    $content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
  <tr>
    <td bgcolor=\"#567188\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
        <tr>
          <td><table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\">
  <tr>
    <th height=\"25\" colspan=\"2\" align=\"center\" nowrap background=\"themes/$ThemeSel/forums/images/top_center.gif\" class=\"thcornerl\"><font color=\"#FABF0D\"><strong>Topics</strong></font></th>
    <th width=\"50\" align=\"center\" nowrap background=\"themes/$ThemeSel/forums/images/top_center.gif\" class=\"thtop\"><font color=\"#FABF0D\"><strong> ;;Replies ;;</strong></font></th>
    <th width=\"100\" align=\"center\" nowrap background=\"themes/$ThemeSel/forums/images/top_center.gif\" class=\"thtop\"><font color=\"#FABF0D\"><strong> ;;Author ;;</strong></font></th>
    <th width=\"50\" align=\"center\" nowrap background=\"themes/$ThemeSel/forums/images/top_center.gif\" class=\"thtop\"><font color=\"#FABF0D\"><strong> ;;Views ;;</strong></font></th>
    <th align=\"center\" nowrap background=\"themes/$ThemeSel/forums/images/top_center.gif\" class=\"thcornerr\"><font color=\"#FABF0D\"><strong> ;;Last Post ;;</strong></font></th>
  </tr>";
    $content .= "$viewlast";

 $content .= "$show";

?>

I'm wondering if there is a way to view private forums with it only for those that have permission to. For example, the site is for my World of Warcraft guild. We have regular forums, member forums (private), and admin forums (private). If I were to go to my site, and someone had recently posted in the admins' forums, I could see the post on my recent topics block, but a guest to the site would not be able to. Sorry if that's confusing. Any ideas?






Not without completely rewriting the block.

In the future kindly use the code tags when pasting code into a forum it makes it easier to read. Thank you Smile






Whoops. Sorry about that Embarassed . Well if that is the case, can you recommend a good block that is capable of what I'm looking for? Thanks!




Attention! You are currently viewing sitemap page!
We strongly suggest to look at original content

Search from web

Valid HTML 4.01 Valid CSS