vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Number of Posts in Current Forum Only (https://vborg.vbsupport.ru/showthread.php?t=32131)

apfeifer 11-03-2001 10:00 PM

Hack: Number of Posts in Current Forum Only
Version of vB: 2.2.0, although may work on earlier versions but not tested
Current Version: 1.0.0
Description: This hack shows how many posts a user has in the forum that the post you are viewing is in


Requested by Bald Bouncer.

MarkB 11-04-2001 09:26 PM

Does this override the current post count display? Or is it displayed seperately? :)

MarkB 11-04-2001 09:33 PM

Ok, I tried it, and the following error came up when viewing a thread:

Fatal error: Call to a member function on a non-object in /home/ultimatm/public_html/forum/admin/functions.php on line 275

apfeifer 11-04-2001 09:34 PM

It is displayed below it, I'll attach a screenshot of it.

Screenshot:

apfeifer 11-04-2001 09:38 PM

Ahh! Thank you! I forgot to add a step:

Find:

PHP Code:

global $showdeficon,$displayemails,$enablepms,$allowsignatures,$wordwrap,$dateformat,$timeformat,$logip,$replacewords,$postsperday,$avatarenabled,$registereddateformat,$viewattachedimages

After that add:

PHP Code:

global $DB_site

Sorry about that! I'll add it into the documentation right away.

:cool:

Scott MacVicar 11-04-2001 09:40 PM

could kinda be bad, if a user has made 300 posts in the forums then thats 300 extra queries per post, you should cache it.

PHP Code:

if (!isset($posttotal[$post[userid]])) {
    
$grabthreadids=$DB_site->query("SELECT threadid FROM post WHERE post.userid='$post[userid]' AND post.visible=1");
    
    
$post[thisforumonly] = "0";

    while (
$getcount=$DB_site->fetch_array($grabthreadids)) {
        
$checkforumid=$DB_site->query_first("SELECT forumid FROM thread WHERE threadid=$getcount[threadid] AND thread.visible=1");
        if (
$checkforumid[forumid] == $forum[0]) {
            
$post[thisforumonly]++;
        }
    }
             
$posttotal[$post[userid]] = $post[thisforumonly];
}
else {
  
$post[thisforumonly] = $posttotal[$post[userid]];



apfeifer 11-04-2001 09:44 PM

Yeah, in the other thread (the request) I mentioned how this had a lot of queries in it. I actually had tried something almost identical to what you did, but it wasn't working so I decided to release it so people had something to use and play with that later. Is that chunk of code you posted 100% sure to work? If so I'll add it in, with your permission, of course.

:cool:

Scott MacVicar 11-04-2001 09:46 PM

I never tested it, just off the top of my head. You should test it first and see if it works.

apfeifer 11-04-2001 09:47 PM

Will do, let me finish documenting this other hack and I will do it ASAP.

:cool:

MarkB 11-04-2001 09:49 PM

The hack works for me now, and I await to see if this caching bizzo works too :cool:

JJR512 11-05-2001 06:27 AM

OK, I tried this hack. While it does work, it also adds a very noticable amount of extra time to open a thread. The more posts in a thread (or I guess more accurately, the more unique people to post in a thread), the worse it gets. Quite noticably.

Please let us know if that cacheing bit works good, after its tested. :)

Bald Bouncer 11-05-2001 08:36 AM

you made me very happy matey :D

apfeifer 11-05-2001 11:08 AM

Quote:

Originally posted by JJR512
OK, I tried this hack. While it does work, it also adds a very noticable amount of extra time to open a thread. The more posts in a thread (or I guess more accurately, the more unique people to post in a thread), the worse it gets. Quite noticably.

Please let us know if that cacheing bit works good, after its tested. :)

Yeah, right now this takes TON'S of queries to do. I am going to add some more stuff to it, including the cache bit, and that should make it better. At the end I should be able to just do one COUNT(*) to get the number, which would greatly improve the speed.

:cool:

Admin 11-05-2001 11:15 AM

Code:

SELECT COUNT(postid) AS posts FROM post LEFT JOIN thread USING (threadid) WHERE thread.forumid='1' AND post.userid='xx'
Gets you the number of posts user #xx made in forum #1.
(btw, this is for one forum only, not from sub forums as well)

But still this is another query for each post, so in a thread with 30 posts per page you will have another 30 queries.

Bald Bouncer 11-06-2001 08:45 AM

is there a way for this hack to count posts made in more than one forum?

SgtSling 11-27-2001 05:06 AM

bump

Joshua Clinard 03-24-2002 06:31 PM

Did anyone ever get this cache thing working?

N9ne 06-23-2002 12:37 AM

yeah?


All times are GMT. The time now is 04:10 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.01251 seconds
  • Memory Usage 1,756KB
  • 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
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (18)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