###############################################
## Hack Title: Count posts?
## Hack Version: 1.0.0
## Author: Antony Bailey
## Description: Allows you to select if posts in forum are counted upon creation.
## Compatibility: 2.0.4
##
## Installation Level: Easy
## Installation Time: 5 minutes.
## Files To Edit: 4
## functions_post.php
## lang_admin.php
## forum_edit_body.tpl
## admin_forums.php
##
## History:
## 1.0.0: Initial Release.
##
## Author Notes:
## Yes, a mod already exists for this. But this is different, and I like it this way.
##
## Support:
http://www.phpbbhacks.com/forums
## Copyright: ©2003 Post Counts? 1.0.0 - Antony Bailey
##
###############################################
## You downloaded this hack from phpBBHacks.com, the #1 source for phpBB related downloads.
## Please visit
http://www.phpbbhacks.com/forums for support.
###############################################
##
###############################################
## This hack is released under the GPL License.
## This hack can be freely used, but not distributed, without permission.
## Intellectual Property is retained by the hack author(s) listed above.
###############################################
#
#----[ OPEN ]----------------------------------------------------
#
includes/functions_post.php
#
#----[ FIND ]----------------------------------------------------
#
$sign = ( $mode == 'delete' ) ? "- 1" : "+ 1";
#
#----[ REPLACE WITH ]--------------------------------------------
#
$sql = "SELECT * FROM " .
FORUMS_TABLE . "
WHERE forum_id = $forum_id";
$result = $db->sql_query($sql);
$forum_information = $db->sql_fetchrow($result);
$count_posts = $forum_information['count_posts'];
if ($mode == 'delete')
{
if ($count_posts)
{
$sign = "- 1";
}
else
{
$sign = "";
}
}
else
{
if ($count_posts)
{
$sign = "+ 1";
}
else
{
$sign = "";
}
}
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/forum_edit_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1">{L_FORUM_STATUS}</td>
<td class="row2"><select name="forumstatus">{S_STATUS_LIST}</select></td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td class="row1">{L_COUNT_POSTS}</td>
<td class="row2"><input type="radio" name="count_posts" value="1" {COUNT_POSTS_YES} />
{L_YES} <input type="radio" name="count_posts" value="0" {COUNT_POSTS_NO}
/> {L_NO}</td>
</tr>
#
#----[ OPEN ]----------------------------------------------------
#
admin/admin_forums.php
#
#----[ FIND ]----------------------------------------------------
#
SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . ", sort_order = " . intval($HTTP_POST_VARS['sort_order']) . "
#
#----[ IN-LINE AFTER ADD ]----------------------------------------
#
, count_posts = " . intval($HTTP_POST_VARS['count_posts']) . "
#
#----[ FIND ]----------------------------------------------------
#
$forumdesc = $row['forum_desc'];
$forumstatus = $row['forum_status'];
#
#----[ AFTER ADD ]-------------------------------------------------
#
$countposts = $row['count_posts'];
#
#----[ FIND ]------------------------------------------------------
#
$forumdesc = '';
$forumstatus = FORUM_UNLOCKED;
#
#----[ AFTER ADD ]-------------------------------------------------
#
$countposts = TRUE;
#
#----[ FIND ]------------------------------------------------------
#
'DESCRIPTION' => $forumdesc)
#
#----[ BEFORE, ADD ]-----------------------------------------------
#
'COUNT_POSTS_YES' => ($row['count_posts'] ? 'checked="checked"' : ''),
'COUNT_POSTS_NO' => (!$row['count_posts'] ? 'checked="checked"' : ''),
'L_COUNT_POSTS' => $lang['Post_count'],
'L_YES' => $lang['Yes'],
'L_NO' => $lang['No'],
#
#----[ OPEN ]----------------------------------------------------
#
language/lang_english/lang_admin.php
#
#----[ FIND ]----------------------------------------------------
#
?>
#
#----[ BEFORE, ADD ]---------------------------------------------
#
$lang['Post_count'] = 'Count Posts in this forum?';
#
#-----[ SAVE/CLOSE ALL FILES ]-----------------------------------
#
#----[ SQL QUERY ]-----------------------------------------------
#
ALTER TABLE `phpbb_forums` ADD `count_posts` CHAR(1) DEFAULT '1' NOT NULL;
#
# EoM
These edits are untested by me.
These were provided by Ricky_Racer from phpBBHacks.com.
They make alterations to the find lines for the hack.
includes/functions_post.php
#
#----[ FIND ]----------------------------------------------------
#
$sign = ($mode == 'delete') ? '- 1' : '+ 1';
admin/admin_forums.php
#
#----[ FIND ]----------------------------------------------------
#
SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "