View Full Version : Seperate Post Count for Selected Forum
Bald Bouncer
10-21-2001, 04:36 PM
is there a way to have a post count to the left that will only count posts made in a certain forum?
thanks
JamesUS
10-21-2001, 06:21 PM
You can set it so that it doesn't count certain forums, so in theory you could set it so it only counts the forum you want. That would affect all post count displays though..if you want a seperate one if needs to be a code hack.
Bald Bouncer
10-21-2001, 07:36 PM
yeah I noticed that mate, I was kinda looking to have both a count for ALL and a count for a chosen Section, anyway if its too hard to do I guess i can live without it....
cheers for the help
Bald Bouncer
10-22-2001, 04:23 PM
bump
webhost
10-22-2001, 05:02 PM
Try this Firefly wrote this for me and it works great, you might have to modify it a little.
http://161.58.84.213/forum/showthread.php?threadid=26988
Bald Bouncer
10-22-2001, 06:41 PM
cheers mate, fron the info Ive been given I think I need something along these lines,
$invposts=$DB_site->query_first("SELECT COUNT(postid) AS posts FROM post LEFT JOIN thread USING (threadid) WHERE forumid=11 OR forumid=23 OR forumid=13 OR forumid=14 OR forumid=15 OR forumid=16 OR forumid=17 OR forumid=18 AND post.userid=$post['userid']");
can anyone fix this please? :confused:
webhost
10-22-2001, 07:19 PM
Here is how I did it, I have post and thread counts go to my forum in my signature and look torwards the bottom forum on the page.
$invposts=$DB_site->query_first("SELECT replycount FROM forum WHERE forumid=29");
$invthreads=$DB_site->query_first("SELECT count(*) AS threadcount FROM thread WHERE forumid=66 OR forumid=23 OR forumid=36 OR forumid=27 OR forumid=25 OR forumid=21 OR forumid=24 OR forumid=87");
Then used this in forumhome template.
Total Posts: <B>$invposts[replycount]</B><br>Total Thread: <B>$invthreads[threadcount]</B>
Bald Bouncer
10-22-2001, 07:40 PM
I see what you have mate, this counts all replys made in a certain forum and displays the total, I just want to display the amount each user has made in a certain forum and display it in their postbit ;)
Stasik
10-22-2001, 07:56 PM
in showthread.php find:
$postbits .= getpostbit($post);
and place BEFORE it:
$user[forumposts]=$DB_site->query_first("SELECT count(*) AS posts FROM post WHERE forumid=$forumid AND userid=$post[userid]");
then you can use "$user[forumposts]" in postbit templates
Admin
10-22-2001, 08:00 PM
Not recommended for performance issues.
You are basically running a query inside a loop, so for every post in a thread that query will be executed.
(trust me, I learned the very hard way)
Stasik
10-22-2001, 08:03 PM
Dont see any another possibility.... postbit templates are made in the same way... a loop for all posts
Admin
10-22-2001, 08:05 PM
Yes, but there are no queries in the getpostbit() function.
Stasik
10-22-2001, 08:13 PM
and? its the same if it will be ran 30times frmo postbit() or direct.......
Admin
10-22-2001, 08:16 PM
You don't understand.
Let's say you have 20 posts on a thread page.
Regulary, the page will use about 20 queries (not verified).
If we add what you said, whether if it's outside the getpostbit() function or inside, the page will use 20 more queries, totalling in 40.
20 more queries = not good.
See what I mean now?
Stasik
10-22-2001, 08:21 PM
wait... will fix function....
Stasik
10-22-2001, 08:25 PM
getpostbit()
find a query there :D:D:D:D:D:D
Stasik
10-22-2001, 08:44 PM
ok, lets say
$post[postdate]=vbdate($dateformat,$post[dateline]);
is a query :D:D:D:D:D:D:D:D:D
Admin
10-22-2001, 08:44 PM
Not a MySQL query.
Stasik
10-22-2001, 08:50 PM
WOW :D:D:D:D:D:D:D:D:D:D
Bald Bouncer
10-23-2001, 06:16 AM
thanks for the effort mate but its still not working, kept showing the techinal support page :(
Bald Bouncer
10-23-2001, 09:03 AM
Database error in vBulletin: Invalid SQL: SELECT count(*) AS posts FROM post WHERE forumid='14' OR forumid='15' AND userid=174
mysql error: Unknown column 'forumid' in 'where clause'
mysql error number: 1054
Date: Tuesday 23rd of October 2001 03:54:35 AM
Script: /forum/showthread.php?s=&postid=17238
Referer: http://66.51.101.96/forum/index.php
theres the error its giving me, if this is any help :(
Stasik
10-23-2001, 12:09 PM
****.... i can do it on complicated way, but it will take much time :(
Bald Bouncer
10-24-2001, 10:43 AM
cheers for trying anyway Stasik
anyone know any easy way, and I thought this would have been easy :D
Bald Bouncer
10-25-2001, 08:31 AM
up
Stasik
10-25-2001, 11:15 AM
its easy..... you have to get all threads in forum and all posts from them.... then you have to check all posts and count the posts posted by user..... it will take just too much time :(
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.