vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Off-Topic Post Counter for Posts in Specified Forum(s) (https://vborg.vbsupport.ru/showthread.php?t=79131)

kall 03-30-2005 09:00 PM

Off-Topic Post Counter for Posts in Specified Forum(s)
 
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 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]
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:

$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: https://vborg.vbsupport.ru/showpost....2&postcount=14

Lee 03-31-2005 05:44 PM

Installed!

rex_b 03-31-2005 05:44 PM

screeny at cruiselineforums.com

lasto 03-31-2005 06:32 PM

cn this be setup so if we have a one section any posts in there (well threads as post are not needed) can be added up ?

kall 03-31-2005 07:20 PM

Quote:

Originally Posted by lasto
cn this be setup so if we have a one section any posts in there (well threads as post are not needed) can be added up ?

I don't understand the question, sorry. :S

lasto 03-31-2005 07:57 PM

is fine m8 it was way i worded it.

Does this work on posts only - would prefer one that actually worked on threads
so if i had a section for posting say pics etc evertime someone made a thread in that section it would increase the counter by 1,but people replying to the same thread would`nt get an increase as its based on threads only.

kall 03-31-2005 08:30 PM

Ahh, right.

Well, as vB is by default, I believe that this hack would achieve what you want. (ie: as far as the $postcount variable is concerned, it increases regardless of whether it was a reply or a post.)

Therefore, new replies OR new threads in the specified OT forum would not add to Post count, but would add to OT Post count. That's why I called it 'OT Posts Hack' and not 'OT new replies Hack'. :)

Carnage 04-01-2005 03:00 PM

you need to add an update counters thing for it. else it'll only apply to posts made after the hack is installed.

kall 04-01-2005 07:01 PM

Quote:

Originally Posted by Carnage-
you need to add an update counters thing for it. else it'll only apply to posts made after the hack is installed.

Well, duh.

If *you* want to make an Update Counters thing for it, go ahead.

I can't find where it is I claim that it works retrospectively anywhere in this thread, so I don't 'need to add' anything.

Carnage 04-01-2005 09:01 PM

Quote:

Originally Posted by kall
Well, duh.

If *you* want to make an Update Counters thing for it, go ahead.

I can't find where it is I claim that it works retrospectively anywhere in this thread, so I don't 'need to add' anything.

mmm true...

i think it should be easy to do thou, just copy the update posts code and change this query:

PHP Code:

$forums $DB_site->query("
        SELECT forumid
        FROM " 
TABLE_PREFIX "forum AS forum
        WHERE (forum.options & 
$_FORUMOPTIONS[countposts])
    "
); 

i think the following should do it:

PHP Code:

$forums $DB_site->query("
        SELECT forumid
        FROM " 
TABLE_PREFIX "forum AS forum
        WHERE !(forum.options & 
$_FORUMOPTIONS[countposts])
    "
); 

alternativly you could try manually setting the folowing variable:

$gotforums = '';

to
$gotforums = '1,2,3';

where 1,2 and 3 are the forum ids of the forums you wish to count


All times are GMT. The time now is 05:30 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01659 seconds
  • Memory Usage 1,757KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_html_printable
  • (5)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete