The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Off-Topic Post Counter for Posts in Specified Forum(s) Details »» | |||||||||||||||||||||||||||
Off-Topic Post Counter for Posts in Specified Forum(s)
Developer Last Online: Aug 2021
PHP Code:
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] ALTER TABLE `user` ADD `otposts` INT( 10 ) UNSIGNED DEFAULT '0' NOT NULL; [/sql] ############################# SQL EDITS DONE ############################### ############################ FILE EDITS START ############################## In includes/functions_newpost.php Find: PHP Code:
PHP Code:
############################ FILE EDITS DONE ############################### ############################ TEMPLATE EDITS START ########################## In postbit (or postbit_legacy) find: HTML Code:
$vbphrase[posts]: $post[posts]</div>
HTML Code:
<div class="smallfont" name="Off-Topic Posts">OT Posts: $post[otposts]</div> 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: https://vborg.vbsupport.ru/showpost....2&postcount=14 Show Your Support
|
Comments |
#12
|
||||
|
||||
Quote:
I don't really feel comfortable playing around with those things, but if anyone wnats to add this and see if it works for them... |
#13
|
|||
|
|||
when i've got more time, ie when i'm not about to go on holiday :P i'll have a play arround and get something fully working.
|
#14
|
||||
|
||||
If we wanted to include a number of forums as off-topic forums, how would we do this? I've replaced x with the forumids which I want to count in the off-topic post count and seperated them with a comma but it doesn't seem to be working.
Code:
if ($foruminfo['forumid'] == '39,63,64,51') |
#15
|
||||
|
||||
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'); } } 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&startat=$finishat&perpage=$perpage\">" . $vbphrase['click_here_to_continue_processing'] . "</a></p>"; } else { define('CP_REDIRECT', 'misc.php'); print_stop_message('updated_post_counts_successfully'); } } Code:
$gootforums = 'X'; Now Find: Code:
print_submit_row($vbphrase['update_post_counts']); 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"); |
#16
|
||||
|
||||
Good stuff Dan, I'll reference it in the first post.
Thanks. |
#17
|
||||
|
||||
Quote:
|
#18
|
||||
|
||||
Quote:
|
#19
|
||||
|
||||
Quote:
|
#20
|
|||
|
|||
how can man fix this script, so that it just count new threads in a forum for Off Topic, and dont count post reply of that thread?
|
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|