Topic: Active Topics

Apologies if there is already one of these out there...

I made an Active Topics mod available here:

http://www.alexking.org/software/punbb/ … cs.php.zip

Example:

http://www.usetasks.com/forums/

2

Re: Active Topics

<?php include('extern.php?action=active&show=13'); ?>

yours seems to show more info

Re: Active Topics

nice!  i'll try it out later when i have time.

Digital photography news, reviews, discussions and more!
http://www.shuttertalk.com

The online bible for all
http://www.publicbible.com

Re: Active Topics

alexkingorg thanks for great hack!

i was looking for this one!

Re: Active Topics

Your zip-file does not work.

Most people are other people. Their thoughts are someone else's opinions, their lives a mimicry, their passions a quotation - Oscar Wilde

6

Re: Active Topics

bobitt wrote:

Your zip-file does not work.

It does work, I've tried it. Though to get Alex's effect then I think there is more to just using the zip file.

7 (edited by Krilik 2004-07-02 05:56)

Re: Active Topics

Actually the zip file was archived weird because the folder inside the zip is called mod_active_topics.php as well as the file, so when you try to unzip it, the zip files reads the folder as the file and not the file inside the folder. You may want to rename your folder to just mod_active_topics when you rearchive it.

EDIT: One more edit BTW tongue great mod.

EDIT: Cleaned up the code so it won't stretch.
Oh and Alex if you didn't want me to post the code I'll edit my post if you want. I just thought it would be helpful because it took me a while to figure out why your zip file was corrupted.

Anyway for people having trouble getting the file out of the zip the code in mod_active_topics.php is:


<?php
/*

PunBB Active Topics

Copyright 2004 Alex King, http://www.alexking.org/

This is a mod for PunBB, http://punbb.org/
PunBB is Copyright (C) 2002, 2003, 2004  Rickard Andersson (rickard@punbb.org)

-------------------------------

You can see this in action at the Use Tasks forums:

  http://www.usetasks.com/forums/


To install, include this file below the forums list in your index.php file:

  include('mod_active_topics.php');

*/

$ak_limit = 25; // change this to the number of active topics you want to display.

$latest = $db->query("SELECT id, subject, last_post, last_poster, posted"
                    ." FROM ".$db->prefix."topics"
                    ." WHERE moved_to IS NULL"
                    ." ORDER BY last_post DESC"
                    ." LIMIT ".$ak_limit
                    );

?>
<table class="punmain" cellspacing="1" cellpadding="4">
    <tr>
        <td class="puncon3" colspan="6" id="latest">Active Topics</td>
    </tr>
    <tr class="punhead">
        <td class="punhead"><?php echo $lang_common['Topic'] ?></td>
        <td class="punhead" style="width: 14%; white-space: nowrap">
                  Last Poster
                </td>
        <td class="punhead" style="width: 25%; white-space: nowrap">
                  <?php echo $lang_common['Last post'] ?>
                </td>
    </tr>
<?php
while ($ak_post = $db->fetch_assoc($ak_latest)) {
?>
    <tr class="puntopic">
        <td class="puncon2"><a href="viewtopic.php?id=<?php echo $ak_post['id'] ?>">
                   <?php echo pun_htmlspecialchars($ak_post['subject']) ?></a>
                </td>
        <td class="puncon1">
                   <?php echo pun_htmlspecialchars($ak_post['last_poster']) ?>
                </td>
        <td class="puncon2" style="white-space: nowrap">
                  <?php echo format_time($ak_post['last_post']) ?>
                </td>
    </tr>
<?php
}
?>
</table>

Re: Active Topics

Doesn't bother me, this code is GPL (as it must be) so you can post it wherever you like. smile

9 (edited by lebel 2004-07-28 14:40)

Re: Active Topics

it seems all users see the topics of the forum admin ...

Re: Active Topics

If some of the posts aren't supposed to be visible to users (none of my forums are like this), you can alter the query that gathers the posts accordingly.

Re: Active Topics

It would be good if you could make the layout like viewforum.php, esp. with the dot and the new icon...

I've extended the mod a bit on my site but will need to play around a bit more...

Digital photography news, reviews, discussions and more!
http://www.shuttertalk.com

The online bible for all
http://www.publicbible.com

Re: Active Topics

I like what you've done, care to share the code?

13 (edited by cuteseal 2004-07-30 01:33)

Re: Active Topics

Sure... here's the bottom bit.

I'd still like to see it more like viewforum.php though... gotta figure out what Rickard's code is doing.. smile

$ak_limit = 25; // change this to the number of active topics you want to display.

$latest = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.last_poster, t.num_replies, f.id 
AS fid, f.forum_name 
FROM '.$db->prefix.'topics 
AS t INNER JOIN '.$db->prefix.'forums 
AS f 
ON t.forum_id=f.id 
WHERE t.moved_to IS NULL 
AND f.admmod_only=0 
ORDER BY last_post 
DESC LIMIT '.$ak_limit);

?>
<table class="punmain" cellspacing="1" cellpadding="4">
    <tr>
        <td class="puncon3" colspan="6" id="latest">Active Topics</td>
    </tr>
    <tr class="punhead">
        <td class="punhead"><?php echo $lang_common['Topic'] ?></td>
        <td class="punhead" style="width: 5%; white-space: nowrap">Replies</td>    
        <td class="punhead" style="width: 25%; white-space: nowrap">Forum</td>
        <td class="punhead" style="width: 14%; white-space: nowrap">Last Poster</td>
        <td class="punhead" style="width: 14%; white-space: nowrap"><?php echo $lang_common['Last post'] ?></td>
    </tr>
<?php
while ($ak_post = $db->fetch_assoc($ak_latest)) {

    $subject_new_posts = '[ <a href="viewtopic.php?id='.$ak_post['id'].'&action=new" title="'.$lang_common['New posts info'].'">'.$lang_common['New posts'].'</a> ]';

?>
    <tr class="puntopic">
        <td class="puncon1"><a href="viewtopic.php?id=<?php echo $ak_post['id'] ?>"><?php echo pun_htmlspecialchars($ak_post['subject']) ?></a> <?php echo $subject_new_posts; ?></td>
        <td class="puncon2"><?php echo pun_htmlspecialchars($ak_post['num_replies']) ?></td>
        <td class="puncon1"><?php echo pun_htmlspecialchars($ak_post['forum_name']) ?></td>
        <td class="puncon2"><?php echo pun_htmlspecialchars($ak_post['last_poster']) ?></td>
        <td class="puncon1" style="white-space: nowrap"><?php echo format_time($ak_post['last_post']) ?></td>
    </tr>
<?php
}
?>
</table>
Digital photography news, reviews, discussions and more!
http://www.shuttertalk.com

The online bible for all
http://www.publicbible.com

Re: Active Topics

Hey, I like what you've done with yours better!  Care to post some code?

Digital photography news, reviews, discussions and more!
http://www.shuttertalk.com

The online bible for all
http://www.publicbible.com

Re: Active Topics

It's the same as the code above, just with a different template for the output.

16 (edited by reviewum.com 2004-11-20 11:18)

Re: Active Topics

cuteseal,  I REALLY like what you did here:
http://www.shuttertalk.com/forums/index.php

For those of us (me) that are php / design challenged could you post the code that you used to create the Recent and Most Active side by side?

Thanks in advance!

Rob Ludlow 
www.Nifty-Stuff.com - Repository of all Stuff Nifty!
www.reviewum.com - Professor Ratings + Teacher Reviews

Re: Active Topics

Could someone post the code for so others cannot see mod/admin only posts?

Re: Active Topics

Also I am totally n00b, where in index.php do you put the code? o.o

Re: Active Topics

It doesnt show mod/admin posts as it is.
You put the index file right at the bottom before the lines

$footer_style = 'index';
require $pun_root.'footer.php';

Personally I put mine on a new page... and put an option to s how many days active topics to show. see mine here

Re: Active Topics

edduddiee, thanks for the post and the help!

Can you and cuteseal post your code?

Rob Ludlow 
www.Nifty-Stuff.com - Repository of all Stuff Nifty!
www.reviewum.com - Professor Ratings + Teacher Reviews

21 (edited by edduddiee 2004-11-21 22:47)

Re: Active Topics

this is the code i use to create my active.php file (well almost only few changes for my personal site style)

<?php
/***********************************************************************

  Copyright (C) 2002, 2003, 2004  Rickard Andersson (rickard@punbb.org)

  This file is part of PunBB.

  PunBB 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,
  or (at your option) any later version.

  PunBB is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  MA  02111-1307  USA

************************************************************************/


$pun_root = './';
require $pun_root.'include/common.php';

// Load the common language file
require $pun_root.'lang/'.$language.'/'.$language.'_common.php';

$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Active Topics';
require $pun_root.'header.php';

$day_limit = 2; // make this the auto number of days you want to be displayed.

$days = isset($_POST['days']) ? $_POST['days'] : $day_limit;
$posts_since = mktime(date("H"), date("i"), date("s"), date("m"), (date("d")-$days), date("Y"));

$latest = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.last_poster, t.num_replies, f.id
AS fid, f.forum_name
FROM '.$db->prefix.'topics
AS t INNER JOIN '.$db->prefix.'forums
AS f
ON t.forum_id=f.id
WHERE t.moved_to IS NULL
AND f.admmod_only=0
AND t.last_post>'.$posts_since.'
ORDER BY last_post DESC');
?>
<table class="punspacer" cellspacing="1" cellpadding="4">
    <tr>
        <td style="width: 14%;"><b><a href="index.php"><?php echo pun_htmlspecialchars($pun_config['o_board_title']) ?></a> / Active Topics</b></td>
        <td class="punright"><form method="post" action="">Days to show: <input type="text" name="days" value="<?php echo $days; ?>" size="3"> <input type="submit" value="Go"></form></td>
    </tr>
</table>
<table class="punmain" cellspacing="1" cellpadding="4">
    <tr class="punhead">
        <td class="punhead"><?php echo $lang_common['Topic'] ?></td>
        <td class="punhead" style="width: 5%; white-space: nowrap">Replies</td>
        <td class="punhead" style="width: 14%; white-space: nowrap">Last Poster</td>
        <td class="punhead" style="width: 14%; white-space: nowrap"><?php echo $lang_common['Last post'] ?></td>
    </tr>
<?php
while ($ak_post = $db->fetch_assoc($latest)) {
    $subject_new_posts = '[ <a href="viewtopic.php?id='.$ak_post['id'].'&action=new" title="'.$lang_common['New posts info'].'">'.$lang_common['New posts'].'</a> ]';
?>
    <tr class="puntopic">
        <td class="puncon2"><a href="viewtopic.php?id=<?php echo $ak_post['id'] ?>&action=new"><?php echo pun_htmlspecialchars($ak_post['subject']) ?></a> <?php echo $subject_new_posts; ?></td>
        <td class="puncon2"><?php echo pun_htmlspecialchars($ak_post['num_replies']) ?></td>
        <td class="puncon2"><?php echo pun_htmlspecialchars($ak_post['last_poster']) ?></td>
        <td class="puncon2" style="white-space: nowrap"><?php echo format_time($ak_post['last_post']) ?></td>
    </tr>
<?php
}
?>
</table>


<table class="punspacer" cellspacing="1" cellpadding="4"><tr><td> </td></tr></table>
<?php
require $pun_root.'footer.php';

Re: Active Topics

Hi guys, thanks for the compliments.  You can download my active topics mod version and recent topics here:
http://www.shuttertalk.com/at.zip

To include them, I use the following lines in index.php

echo '<table class="punspacer" cellspacing="1" cellpadding="4"><tr><td> </td></tr></table>';
echo '<table border="0">';
echo '<tr><td width="50%" valign="top">';
include('mod_recent_topics.php');
echo '</td><td width="50%" valign="top">';
include('mod_active_topics.php');
echo '</td></tr></table>';
Digital photography news, reviews, discussions and more!
http://www.shuttertalk.com

The online bible for all
http://www.publicbible.com

Re: Active Topics

Great guys, thanks for those posts.   The only thing I noticed was the need to edit cuteseal's mods so the titles reflected the correct content ie; Active Topic was duplicated in both files as the "Title".

Great work guys!  Hopefully this will be implemented in the next version!

Rob Ludlow 
www.Nifty-Stuff.com - Repository of all Stuff Nifty!
www.reviewum.com - Professor Ratings + Teacher Reviews

24

Re: Active Topics

Very Nice.

Yours, Benny.

Re: Active Topics

Friends,

I tried to do this mod on a new install of punBB 1.2 and got the following error:

"Notice: Undefined variable: ak_latest in /home/user/public_html/talk/index.php on line 256"

Any ideas what's going on and/or how to fix it?

Thanks in advance!

Rob Ludlow 
www.Nifty-Stuff.com - Repository of all Stuff Nifty!
www.reviewum.com - Professor Ratings + Teacher Reviews