vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Forum Post Count (https://vborg.vbsupport.ru/showthread.php?t=201682)

Nintendo-Daily 01-13-2009 10:22 PM

Forum Post Count
 
I want the total post count for a forum on my vBulletin Board to not count toward the board's total post count. Can this be done?

Bellardia 01-13-2009 11:28 PM

Forums And Moderators > Forum Manager > Find the one you want > Count Posts Made in this Forum Towards User Post Counts > No!

Nintendo-Daily 01-13-2009 11:31 PM

Quote:

Originally Posted by Bellardia (Post 1711527)
Forums And Moderators > Forum Manager > Find the one you want > Count Posts Made in this Forum Towards User Post Counts > No!

Wrong.

Not user post counts, total board count. Basically, I want to subtract the number of posts already in a forum from the board total.

Bellardia 01-13-2009 11:46 PM

Ah, poor reading on my part :(

Not sure of any ways to do it without editing the code or manipulating it with a plugin.

Nintendo-Daily 01-14-2009 04:28 PM

Does anyone else know how to do this?

Lynne 01-14-2009 05:06 PM

Are you simply talking about the post count on the index.php page? It looks like the total post count is grabbed from the forumcache and you can probably use construct_forum_bit (in functions_forumlist.php) to get the reply count for that particular forum and then just do a quick calculation to spit out what you want.

Nintendo-Daily 01-14-2009 09:42 PM

Thanks Lynne. I have no idea how I would do that though. Any advice?

Lynne 01-14-2009 11:04 PM

Quote:

Originally Posted by Nintendo-Daily (Post 1712616)
Thanks Lynne. I have no idea how I would do that though. Any advice?

I'd go find the function I was talking about and also read about it in here - http://members.vbulletin.com/api/ I'd also see how the function was used previously so you see what goes in and what comes out. Then just add the code into the index page at the bottom under where the total postcount is grabbed from the cache.

iBardia 01-14-2009 11:09 PM

I get what you are saying.

Seems pretty hard though..

Lynne 01-14-2009 11:45 PM

Actually, I just relooked and saw it's already there in the cache (and I don't know what I was thinking of using that function - middle of the afternoon brain fart or something). You can see it totaling up the posts in the function, just grab the total for that forum and do what you want with it:

Code:

if (is_array($vbulletin->forumcache))
{
    foreach ($vbulletin->forumcache AS $forum)
    {
        $totalthreads += $forum['threadcount'];
        $totalposts += $forum['replycount'];
        if ($forum['forumid'] == xx) $forumpostcount = $forum['replycount'];
    }
}


Nintendo-Daily 01-15-2009 12:24 AM

Thanks so much Lynne. What file is that though and where is it located? I looked in the "functions_forumlist.php" file and it wasn't in there. Well, I did a search in the file for "$forumpostcount" and didn't find it.

Lynne 01-15-2009 02:38 AM

It's at the bottom of the index.php page. The line in red is what I added, so you aren't going to find $forumpostcount anywhere.

Nintendo-Daily 01-15-2009 03:28 AM

Thanks, Lynne. I am still confused about what I need this to look like exactly though.

if ($forum['forumid'] == xx) $forumpostcount = $forum['replycount'];

Could you maybe give me an example so I don't mess anything up?

Lynne 01-15-2009 03:42 AM

xx is the forumid you want to get the post count of and then it will be stored in $forumpostcount (or whatever you want to call that variable). Then you can use that number to calculate the total posts on the board minus those in that forum.

Dismounted 01-15-2009 04:36 AM

You must do the calculation in the file before the reply count is formatted using vb_number_format().

Nintendo-Daily 01-15-2009 09:02 PM

OK, I am officially confused now :(

@ Lynne: Are you saying all I have to do is insert that line of code but just add the forum ID for the forum I wish not to count toward the board's total count?

@ Dismounted: huh?

Lynne 01-15-2009 09:34 PM

Add that line, but change the xx to the forum id. Then, the line will give you the post count in that forum. Then, outside of the loop, you need to perform your calculation ($totalposts - $forumpostcount) and, as Hanson said, you need to do that before you format the number (a couple lines down from that code).

I would strongly suggest you just play with this on your test site. You will learn a lot by just trying things out. That will help you in the long run because you will be more willing to modify other modifications and personalize your site.

Nintendo-Daily 01-15-2009 09:39 PM

unfortunately, I don't have a test site. Also, what do you mean when you say outside of the loop?

Lynne 01-15-2009 09:54 PM

PHP Looping

Step by Step: Create a test forum based on a 'snapshot' of your live one


All times are GMT. The time now is 04:09 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.01266 seconds
  • Memory Usage 1,749KB
  • 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
  • (1)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (19)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete