Members   Search      Help    Register    Login    Home
Home » Discussion Forums » M0dZ & HaCkZ » add last forum posts to your index(this mod is for PMBT 2.X)
add last forum posts to your index [message #2339] Fri, 13 February 2009 12:26 Go to next message
joeroberts is currently offline joeroberts  United States
Messages: 1971
Registered: June 2006
Location: U.S.A
Releaser
Da HacKer
This mod well add the last forum posts to your tracker index
First you well need to create a new file called forumposts.php and add this
<?php
 
if ($user->user)
 {
     
define'IN_PHPBB'true );
    
$phpbb_root_path './'.$forumbase.'/'// change in your own root path.
    
$phpEx substr(strrchr(__FILE__'.'), 1);
    include(
$phpbb_root_path 'common.' $phpEx);
    include(
$phpbb_root_path 'includes/functions_display.' $phpEx);
    include(
$phpbb_root_path 'includes/bbcode.' $phpEx);
    
    
$user->session_begin();
    
$auth->acl$user->data );
    
$user->setup();

    
//-- Fetch the data from the specified fora
    
$bbcode = new bbcode();
    
$news_fora_id = array( 25,19,20,16); // Change in the fora id's you need
    
$output '';
    
    
$topic_count '10'// Change in the number of topics you want to show.
    
$query "
        SELECT p.topic_id, p.forum_id, p.post_time, p.post_subject,  p.post_text, p.bbcode_bitfield, p.bbcode_uid,
            u.user_id, u.user_email, u.username, u.user_posts,  u.user_rank, u.user_colour, u.user_allow_viewonline, u.user_allow_viewemail,
            t.topic_title,
                (
                    SELECT COUNT( post_id )
                    FROM " 
POSTS_TABLE "
                        WHERE topic_id = p.topic_id
                ) AS aantal_posts
        FROM " 
POSTS_TABLE " AS p, " USERS_TABLE " AS u, " TOPICS_TABLE " AS t
            WHERE " 
$db->sql_in_set'p.forum_id'$news_fora_id ) . "
                AND u.user_id = p.poster_id
                AND t.topic_id = p.topic_id
        GROUP BY topic_id
        ORDER BY t.topic_time DESC
        LIMIT 0, {$topic_count}
    "
;

    
//die('<pre>' . $query );
    
$result $db->sql_query$query )or btsqlerror($query);
        
$output .= "<table class=\"torrenttable\" border=\"0\" cellpadding=\"3\"  width=\"100%\">";
        
$output .="<thead>\n<tr><th><p>Topics</p></th>";
        
$output .="<th><p>Replies</p></th>";
        
$output .="<th><p>Views</p></th>";

        
$output .= "</tr></thead>\n";

    while( 
$row $db->sql_fetchrow($result) )
    {
    
$sql_view ="SELECT * FROM " TOPICS_TABLE " WHERE topic_id = "$row['topic_id'] . "";
$res_views $db->sql_query($sql_view);
$row_views $db->sql_fetchrow($res_views);
        
// Parse the message and subject
        
$message censor_text($row['post_text']);

        
// Second parse bbcode here
        
if ($row['bbcode_bitfield'])
        {
            
$bbcode->bbcode_second_pass($message$row['bbcode_uid'], $row['bbcode_bitfield']);
        }

        
//$message = bbcode($message);
        
$message smiley_text($message);
        
        
// Send data to output var
        
$output .= "<tbody>\n";
        
$output .="<td class=\"torrenttable\">";
        
$output .= "<a  href=\"phpBB.php?page=viewtopic&amp;f={$row['forum_id']} &amp;t={$row['topic_id']}\"  title=\""  censor_text($row['post_subject']) . "\">".censor_text($row['post_subject'])."</a>      <br>By <a  href=\"phpBB.php?page=memberlist&mode=viewprofile&u= "  $row['user_id'] . "\"  style='color:#9E8DA7'>" $row['username'] ."</a> on \n";
        
$output .= $user->format_date($row['post_time'])."\n" ;
        
$output .= "</td>\n" ;
        
$output .="<td>";
        
$output .= $row['aantal_posts']-."\n";
        
$output .="</td>";
        
$output .="<td>";
        
$output .= $row_views['topic_views']."\n";
        
$output .="</td>";
        
$output .="</tbody>\n";
    }
        
$output .="</table>\n";

    
// print the output
OpenTable('Resent Forum Posts');
    print( 
$output);
CloseTable();    
}
?>

make sure you edit to what you like
<?php
$news_fora_id 
= array( 25,19,20,16); // Change in the fora id's you need
?>

this one is an array and you only add the forum not the posts
<?php
$topic_count 
'10'// Change in the number of topics you want to show.
?>
this is how many posts you want to show on the index
now open index.php and add
<?php
include ("forumposts.php");
?>

where you want it to show up


http://a.imageshack.us/img831/5562/mybikes.png
Re: add last forum posts to your index [message #3934 is a reply to message #2339] Fri, 23 April 2010 07:21 Go to previous messageGo to next message
Fantazy is currently offline Fantazy  Sweden
Messages: 69
Registered: April 2010
Seeder
Thank's! Smile Smile

http://img26.imageshack.us/img26/443/42918339485.jpg
Re: add last forum posts to your index [message #3935 is a reply to message #3934] Fri, 23 April 2010 20:42 Go to previous messageGo to next message
Fantazy is currently offline Fantazy  Sweden
Messages: 69
Registered: April 2010
Seeder
Is it mean't that newest uploads shows up in most recent forum posts, because it does in mine, heehe?

http://img26.imageshack.us/img26/443/42918339485.jpg
Re: add last forum posts to your index [message #3936 is a reply to message #3935] Fri, 23 April 2010 20:50 Go to previous messageGo to next message
joeroberts is currently offline joeroberts  United States
Messages: 1971
Registered: June 2006
Location: U.S.A
Releaser
Da HacKer
if you have it set to in forum intergration setting in tracker admin panel

http://a.imageshack.us/img831/5562/mybikes.png
Re: add last forum posts to your index [message #3937 is a reply to message #3936] Fri, 23 April 2010 20:54 Go to previous message
Fantazy is currently offline Fantazy  Sweden
Messages: 69
Registered: April 2010
Seeder
Of course, my bad, the brain isn't with me...

http://img26.imageshack.us/img26/443/42918339485.jpg
Previous Topic:Swedish Language
Next Topic:Staff Page Mod
Goto Forum:
  


Current Time: Wed Feb 08 21:11:48 GMT 2012

Total time taken to generate the page: 0.00762 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software