Back to vBulletin 3.0 Add-Ons

Off-Topic Post Counter for Posts in Specified Forum(s)
Mod Version: 1.00, by kall

This modification is in the archives.
vB Version: 3.0.7 Rating: (0 vote - 0 average) Installs: 6
Released: 31 Mar 2005 Last Update: Never Downloads: 5
Not Supported  

PHP Code:
/*======================================================================*\
|| #################################################################### ||
|| # Off-Topic Post Count for Specified Forums                        # ||
|| # ---------------------------------------------------------------- # ||
|| # An NZBoards Production!                                          # ||
|| # Project Began: 0803 1 April 2005 (GMT)                           # ||
|| # Project Finished: 0818 1 April 2005   (GMT)                      # ||
|| # Version Released: 1.0                                            # ||
|| # Modification by: Kall                                            # ||
|| # This may not be redistributed without NZBoards Consent         # ||
|| # The above line applies to all you filthy pirates.                # ||
|| # Copyright 2005 [url]www.nzboards.com[/url]                                  # ||
|| #################################################################### ||
\*======================================================================*/ 
As requested by rex of http://www.cruiselineforums.com:

What does this hack do?

Adds a new Post Counter, for off-topic posts.

It enables you to define a Forum (or Forums) as 'Off-Topic Forums'.
Any posts made by users in that Forum are not added to the Post count, they are added to the Off-Topic Post count instead.

As a bonus, OT posting won't be rewarded with promotions or points or anything linked to $bbuserinfo[posts].

Queries to run: One
Files to edit: One
Templates to edit: One (postbit or postbit_legacy).

########################### SQL EDITS START ###############################

Run this query: (change user to yourtableprefix_user if you use a table prefix).
SQL Query: (how to run queries)
ALTER TABLE `user` ADD `otposts` INT( 10 ) UNSIGNED DEFAULT '0' NOT NULL;
############################# SQL EDITS DONE ###############################

############################ FILE EDITS START ##############################

In includes/functions_newpost.php

Find:
PHP Code:
$doposts 'posts = posts + 1,'
Change to (make X equal to the forumid of your Off-topic forum):
PHP Code:
if ($foruminfo['forumid'] == 'X')
{
$doposts 'otposts = otposts + 1,';
}
else
{
$doposts 'posts = posts + 1,';

Save and upload.

############################ FILE EDITS DONE ###############################

############################ TEMPLATE EDITS START ##########################

In postbit (or postbit_legacy) find:
HTML Code:
$vbphrase[posts]: $post[posts]</div>
Under, add:
HTML Code:
<div class="smallfont" name="Off-Topic Posts">OT Posts: $post[otposts]</div>
############################ TEMPLATE EDITS DONE ###########################

And you are done.

Rejoice!

Updates:
0850 1 April 2005 (GMT+12): Added name attribute to div tag for mouseover explanation.

1800 7 April 2005: Dan's AdminCP Update Offtopic Counter Addon:

Spoiler (click to open)


Nevermind I figured it out xD

To Update Forum Posts Easily I created a easy modifcation!

Find in /admincp/misc.php
Code:
define('CP_REDIRECT', 'misc.php');
print_stop_message('updated_post_counts_successfully');
}
}
Add Below:

Code:
// ###################### Start update Off Topic Post Counts ################
if ($_REQUEST['do'] == 'updatespam')
{
if (empty($perpage))
{
$perpage = 1000;
}
echo '<p>' . $vbphrase['updating_post_counts'] . '</p>';
$forums = $DB_site->query("
SELECT forumid
FROM " . TABLE_PREFIX . "forum AS forum
WHERE !(forum.options & $_FORUMOPTIONS[countposts])
");
$gootforums = 'X';
while ($forum = $DB_site->fetch_array($forums))
{
$gootforums .= ',' . $forum['forumid'];
}
$users = $DB_site->query("SELECT userid FROM " . TABLE_PREFIX . "user WHERE userid >= $startat AND userid < $finishat ORDER BY userid DESC");
while ($user = $DB_site->fetch_array($users))
{
$totalposts = $DB_site->query_first("
SELECT COUNT(*) AS posts FROM " . TABLE_PREFIX . "post AS post
INNER JOIN " . TABLE_PREFIX . "thread AS thread USING (threadid)
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog_t ON (deletionlog_t.primaryid = thread.threadid AND deletionlog_t.type = 'thread')
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog_p ON (deletionlog_p.primaryid = post.postid AND deletionlog_p.type = 'post')
WHERE post.userid = $user[userid] AND
	thread.forumid IN (0$gootforums) AND
	deletionlog_t.primaryid IS NULL AND
	deletionlog_p.primaryid IS NULL
");
$DB_site->query("UPDATE " . TABLE_PREFIX . "user SET otposts=$totalposts[posts] WHERE userid = $user[userid]");
echo construct_phrase($vbphrase['processing_x'], $user['userid']) . "<br />\n";
flush();
}
if ($checkmore = $DB_site->query_first("SELECT userid FROM " . TABLE_PREFIX . "user WHERE userid >= $finishat LIMIT 1"))
{
print_cp_redirect("misc.php?$session[sessionurl]do=updateposts&startat=$finishat&perpage=$perpage");
echo "<p><a href=\"misc.php?$session[sessionurl]do=updateposts&amp;startat=$finishat&amp;perpage=$perpage\">" . $vbphrase['click_here_to_continue_processing'] . "</a></p>";
}
else
{
define('CP_REDIRECT', 'misc.php');
print_stop_message('updated_post_counts_successfully');
}
}
Remember to change X in the above code
Code:
$gootforums = 'X';
To whatever your off topic forums are.


Now Find:

Code:
print_submit_row($vbphrase['update_post_counts']);
Add Below:

Code:
print_form_header('misc', 'updatespam');
print_table_header("Update Off Topic Posts", 2, 0);
print_description_row("This will update the Off Topic Post Count");
print_input_row($vbphrase['number_of_users_to_process_per_cycle'], 'perpage', 1000);
print_submit_row("Update Off Topic Posts");
And there you go! Now you can up date it easily!

Close

Download

This modification is archived and cannot be downloaded.


vblts.ru supports vBulletin®, 2022-2024