PDA

View Full Version : Post count hack?


ludachris
02-23-2005, 08:22 PM
So, in the postbit template, we have the post count # displayed for each member (at least some of us do). I was wondering if there was a way to build a post count for a member for only specified forums...

Post Count (for forumID[10] AND forumID(12): 25

So if a user has a total of 25 posts in ForumID(10) and ForumID(12) combined, then their post count would show up as 25. The reason I'd want this is because these are my important forums, and I want people to see how much these users contribute in those forums as opposed to knowing their overall post count. Is this possible? And how much load would it put on the server since it would be displayed in postbit?


Edit:
Actually, just found basically what I'm looking for already done for vB2... anyone seen it for vB3 yet:
https://vborg.vbsupport.ru/showthread.php?t=48977
If not, can someone PLEASE rewrite it for vB3?!?!?!?!?!

DRJ
02-23-2005, 09:00 PM
What I do is only count posts for certain forums.

Otherwise, somthing like this should work.


$postcount = $DB_site->query("SELECT count( * );
FROM vb3_post As p, vb3_thread As t
WHERE p.threadid = t.threadid
AND t.forumid = XX
AND p.userid = YY
");

ludachris
02-23-2005, 09:35 PM
What I do is only count posts for certain forums.

Otherwise, somthing like this should work.


$postcount = $DB_site->query("SELECT count( * );
FROM vb3_post As p, vb3_thread As t
WHERE p.threadid = t.threadid
AND t.forumid = XX
AND p.userid = YY
");

What file would I find that in? I think I'd want to keep the overall post count and have a secondary post count. I'm assuming this would be the only post counter?

DRJ
02-23-2005, 11:42 PM
There is a mistake, remove the ; from the first line.

You could add this code to your showthread.php

$postcount= $DB_site->query("SELECT count( * )
FROM vb3_post As p, vb3_thread As t
WHERE p.threadid = t.threadid
AND t.forumid In(16,17,18)
AND p.userid = $post[userid]

Then add $postcount to your postbit_legacy template whereever you want the number to appear.

I this example we are counting posts in forum 16, 17, 18.

Note that this would run a query for each post in the thread everytime anyone viewed any thread.

Marco van Herwaarden
02-24-2005, 06:15 AM
Sorry guys, but no hack is needed for this in vB3.

Edit your Forum settings, you will find a setting called something like "Posts in this forum add to postcount". Set this to No for all forums, except the ones mentioned above.

DRJ
02-24-2005, 06:38 AM
He said he wanted to keep the overall post count and also add a secondary count for each user shown on the posts.

ludachris
02-24-2005, 05:18 PM
Sorry guys, but no hack is needed for this in vB3.

Edit your Forum settings, you will find a setting called something like "Posts in this forum add to postcount". Set this to No for all forums, except the ones mentioned above.
I'd like to keep an overall count plus a secondary count.

And I'm assuming that if I were to change it via the control panel, only counting posts from a few of my forums instead of most all, then recalculate post counts, that any Ranks I have set up would be based on the new smaller post count and not the true (much larger) overall post count?

If this is the case, I really don't want to do it via the forum settings. I'd like to see about doing it like the hack that I linked to above - adding a secondary post (special) counter. Can anyone port that hack to vB3?

Marco van Herwaarden
02-25-2005, 06:32 AM
Sorry overlooked the part where you said you also wanted to keep the full postcount.

ludachris
02-25-2005, 06:17 PM
Sorry overlooked the part where you said you also wanted to keep the full postcount.
So I think I figured out how to do it... I duplicated the 'posts' field in table 'user' and named it 'posts_new'. Then, in "functions_newpost.php" I added code that should update the user's post count AND their post_new count at the same time. So now, going forward, I believe it will count all new posts (only for the specificed forums) in the new field.

However, how would I write a script that updates that count for all posts in those forums prior?

ludachris
03-08-2005, 10:28 PM
It's too bad that people don't get the same amount of help here in the "free" forum now that there's a "payed service request" forum. This place used to be full of helpful people who didn't mind lending a hand with questions like this. Looks like there isn't much help available at all unless you want to pay to have your question answered... or maybe there just aren't as many people on here who know what they're doing with VB3. I guess people are still figuring out VB3.

AtoZ
11-02-2005, 04:34 AM
Sorry to reply to an old thread, but I am looking for exactly the same thing and this is the first thread I've found that addresses it directly.

ludachris, did you get this working? Does anyone else have ideas on what to do?

I am planning to upgrade to 3.5 soon, so perhaps it will be easier to work through in 3.5?

Update: I think I may have found it here:
https://vborg.vbsupport.ru/showthread.php?t=68041
It's still classified as "beta" though...

Anyone know of a 3.5 hack like this?

ludachris
11-04-2005, 02:44 PM
Sorry to reply to an old thread, but I am looking for exactly the same thing and this is the first thread I've found that addresses it directly.

ludachris, did you get this working? Does anyone else have ideas on what to do?

I am planning to upgrade to 3.5 soon, so perhaps it will be easier to work through in 3.5?

Update: I think I may have found it here:
https://vborg.vbsupport.ru/showthread.php?t=68041
It's still classified as "beta" though...

Anyone know of a 3.5 hack like this?

I haven't gotten it to work. Might have to post in the 3.5 section since nobody seems to see this thread.