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:
You are not logged in. Please login or register.
PunBB Forums → PunBB 1.2 modifications, plugins and integrations → 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:
<?php include('extern.php?action=active&show=13'); ?>
yours seems to show more info
nice! i'll try it out later when i have time.
alexkingorg thanks for great hack!
i was looking for this one!
Your zip-file does not work.
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.
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 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>
Doesn't bother me, this code is GPL (as it must be) so you can post it wherever you like.
it seems all users see the topics of the forum admin ...
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.
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...
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..
$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>
Hey, I like what you've done with yours better! Care to post some code?
It's the same as the code above, just with a different template for the output.
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!
Could someone post the code for so others cannot see mod/admin only posts?
Also I am totally n00b, where in index.php do you put the code? o.o
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
edduddiee, thanks for the post and the help!
Can you and cuteseal post your code?
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';
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>';
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!
Very Nice.
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!
PunBB Forums → PunBB 1.2 modifications, plugins and integrations → Active Topics
Powered by PunBB, supported by Informer Technologies, Inc.